Browse Source

DATAMONGO-1521 - Added Aggregation.skip(…) overload to support longs.

Deprecated the one taking an int.
pull/663/head
Oliver Gierke 9 years ago
parent
commit
4875f07a92
  1. 11
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Aggregation.java
  2. 4
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/SkipOperation.java

11
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Aggregation.java

@ -245,11 +245,22 @@ public class Aggregation {
* *
* @param elementsToSkip must not be less than zero. * @param elementsToSkip must not be less than zero.
* @return * @return
* @deprecated prepare to get this one removed in favor of {@link #skip(long)}.
*/ */
public static SkipOperation skip(int elementsToSkip) { public static SkipOperation skip(int elementsToSkip) {
return new SkipOperation(elementsToSkip); return new SkipOperation(elementsToSkip);
} }
/**
* Creates a new {@link SkipOperation} skipping the given number of elements.
*
* @param elementsToSkip must not be less than zero.
* @return
*/
public static SkipOperation skip(long elementsToSkip) {
return new SkipOperation(elementsToSkip);
}
/** /**
* Creates a new {@link LimitOperation} limiting the result to the given number of elements. * Creates a new {@link LimitOperation} limiting the result to the given number of elements.
* *

4
spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/SkipOperation.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2013-2015 the original author or authors. * Copyright 2013-2016 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -38,7 +38,7 @@ public class SkipOperation implements AggregationOperation {
/** /**
* Creates a new {@link SkipOperation} skipping the given number of elements. * Creates a new {@link SkipOperation} skipping the given number of elements.
* *
* @param skipCount number of documents to skip. * @param skipCount number of documents to skip, must not be less than zero.
*/ */
public SkipOperation(long skipCount) { public SkipOperation(long skipCount) {

Loading…
Cancel
Save