diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Aggregation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Aggregation.java index 124dd6517..efe60dcb3 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Aggregation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/Aggregation.java @@ -424,6 +424,7 @@ public class Aggregation { * * @param groupByField must not be {@literal null} or empty. * @return + * @since 1.10 */ public static BucketOperation bucket(String groupByField) { return new BucketOperation(field(groupByField)); @@ -434,6 +435,7 @@ public class Aggregation { * * @param groupByExpression must not be {@literal null}. * @return + * @since 1.10 */ public static BucketOperation bucket(AggregationExpression groupByExpression) { return new BucketOperation(groupByExpression); @@ -445,6 +447,7 @@ public class Aggregation { * @param groupByField must not be {@literal null} or empty. * @param buckets number of buckets, must be a positive integer. * @return + * @since 1.10 */ public static BucketAutoOperation bucketAuto(String groupByField, int buckets) { return new BucketAutoOperation(field(groupByField), buckets); @@ -456,6 +459,7 @@ public class Aggregation { * @param groupByExpression must not be {@literal null}. * @param buckets number of buckets, must be a positive integer. * @return + * @since 1.10 */ public static BucketAutoOperation bucketAuto(AggregationExpression groupByExpression, int buckets) { return new BucketAutoOperation(groupByExpression, buckets); @@ -465,6 +469,7 @@ public class Aggregation { * Creates a new {@link FacetOperation}. * * @return + * @since 1.10 */ public static FacetOperation facet() { return FacetOperation.EMPTY; @@ -475,6 +480,7 @@ public class Aggregation { * * @param aggregationOperations the sub-pipeline, must not be {@literal null}. * @return + * @since 1.10 */ public static FacetOperationBuilder facet(AggregationOperation... aggregationOperations) { return facet().and(aggregationOperations); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationRenderer.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationRenderer.java index 20dcb58a7..0cb930df1 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationRenderer.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationRenderer.java @@ -28,7 +28,7 @@ import com.mongodb.DBObject; /** * Rendering support for {@link AggregationOperation} into a {@link List} of {@link com.mongodb.DBObject}. - * + * * @author Mark Paluch * @author Christoph Strobl * @since 1.10 @@ -40,7 +40,7 @@ class AggregationOperationRenderer { /** * Render a {@link List} of {@link AggregationOperation} given {@link AggregationOperationContext} into their * {@link DBObject} representation. - * + * * @param operations must not be {@literal null}. * @param context must not be {@literal null}. * @return the {@link List} of {@link DBObject}. diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperation.java index 9ad0d6f66..987d85916 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperation.java @@ -23,18 +23,18 @@ import com.mongodb.BasicDBObject; import com.mongodb.DBObject; /** - * Encapsulates the aggregation framework {@code $bucketAuto}-operation. - *

+ * Encapsulates the aggregation framework {@code $bucketAuto}-operation.
* Bucket stage is typically used with {@link Aggregation} and {@code $facet}. Categorizes incoming documents into a * specific number of groups, called buckets, based on a specified expression. Bucket boundaries are automatically - * determined in an attempt to evenly distribute the documents into the specified number of buckets. - *

- * We recommend to use the static factory method {@link Aggregation#bucketAuto(String, int)} instead of creating instances of - * this class directly. + * determined in an attempt to evenly distribute the documents into the specified number of buckets.
+ * We recommend to use the static factory method {@link Aggregation#bucketAuto(String, int)} instead of creating + * instances of this class directly. * - * @see http://docs.mongodb.org/manual/reference/aggregation/bucketAuto/ + * @see http://docs.mongodb.org/manual/reference/aggregation/bucketAuto/ * @see BucketOperationSupport * @author Mark Paluch + * @author Christoph Strobl * @since 1.10 */ public class BucketAutoOperation extends BucketOperationSupport @@ -100,13 +100,12 @@ public class BucketAutoOperation extends BucketOperationSupport + * Use either predefined {@link Granularities} or provide a own one. * * @param granularity must not be {@literal null}. * @return @@ -133,7 +134,7 @@ public class BucketAutoOperation extends BucketOperationSupporthttp://docs.mongodb.org/manual/reference/aggregation/bucket/ * @see BucketOperationSupport * @author Mark Paluch * @since 1.10 @@ -109,7 +109,7 @@ public class BucketOperation extends BucketOperationSupport newBoundaries = new ArrayList(this.boundaries.size() + boundaries.length); newBoundaries.addAll(this.boundaries); @@ -197,7 +198,7 @@ public class BucketOperation extends BucketOperationSupport - * Bucket stages collect documents into buckets and can contribute output fields. - *

+ * Base class for bucket operations that support output expressions the aggregation framework.
+ * Bucket stages collect documents into buckets and can contribute output fields.
* Implementing classes are required to provide an {@link OutputBuilder}. * - * @see http://docs.mongodb.org/manual/reference/aggregation/bucket/ * @author Mark Paluch + * @author Christoph Strobl * @since 1.10 */ public abstract class BucketOperationSupport, B extends OutputBuilder> @@ -50,7 +48,7 @@ public abstract class BucketOperationSupport operationSupport) { @@ -88,7 +85,7 @@ public abstract class BucketOperationSupport, T extends BucketOperationSupport> @@ -232,11 +229,9 @@ public abstract class BucketOperationSupport + * Generates a builder for a {@code $sum}-expression.
* Count expressions are emulated via {@code $sum: 1}. - *

- * + * * @return */ public B count() { @@ -245,7 +240,7 @@ public abstract class BucketOperationSupport + * Encapsulates an output field in a bucket aggregation stage.
* Output fields can be either top-level fields that define a valid field name or nested output fields using * operators. - * + * * @author Mark Paluch */ protected abstract static class Output implements AggregationExpression { @@ -514,17 +504,10 @@ public abstract class BucketOperationSupport + * Output field that uses a Mongo operation (expression object) to generate an output field value.
* {@link OperationOutput} is used either with a regular field name or an operation keyword (e.g. * {@literal $sum, $count}). * @@ -624,7 +607,6 @@ public abstract class BucketOperationSupport + * Encapsulates the aggregation framework {@code $facet}-operation.
* Facet of {@link AggregationOperation}s to be used in an {@link Aggregation}. Processes multiple * {@link AggregationOperation} pipelines within a single stage on the same set of input documents. Each sub-pipeline * has its own field in the output document where its results are stored as an array of documents. * {@link FacetOperation} enables various aggregations on the same set of input documents, without needing to retrieve - * the input documents multiple times. - *

+ * the input documents multiple times.
* As of MongoDB 3.4, {@link FacetOperation} cannot be used with nested pipelines containing {@link GeoNearOperation}, - * {@link OutOperation} and {@link FacetOperation}. - *

+ * {@link OutOperation} and {@link FacetOperation}.
* We recommend to use the static factory method {@link Aggregation#facet()} instead of creating instances of this class * directly. * * @see http://docs.mongodb.org/manual/reference/aggregation/facet/ * @author Mark Paluch + * @author Christoph Strobl * @since 1.10 */ public class FacetOperation implements FieldsExposingAggregationOperation { @@ -67,11 +65,10 @@ public class FacetOperation implements FieldsExposingAggregationOperation { } /** - * Creates a new {@link FacetOperationBuilder} to append a new facet using {@literal operations}. - *

+ * Creates a new {@link FacetOperationBuilder} to append a new facet using {@literal operations}.
* {@link FacetOperationBuilder} takes a pipeline of {@link AggregationOperation} to categorize documents into a * single facet. - * + * * @param operations must not be {@literal null} or empty. * @return */ @@ -118,7 +115,7 @@ public class FacetOperation implements FieldsExposingAggregationOperation { /** * Creates a new {@link FacetOperation} that contains the configured pipeline of {@link AggregationOperation} * exposed as {@literal fieldName} in the resulting facet document. - * + * * @param fieldName must not be {@literal null} or empty. * @return */ @@ -132,7 +129,7 @@ public class FacetOperation implements FieldsExposingAggregationOperation { /** * Encapsulates multiple {@link Facet}s - * + * * @author Mark Paluch */ private static class Facets { @@ -143,7 +140,7 @@ public class FacetOperation implements FieldsExposingAggregationOperation { /** * Creates a new {@link Facets} given {@link List} of {@link Facet}. - * + * * @param facets */ private Facets(List facets) { @@ -153,7 +150,7 @@ public class FacetOperation implements FieldsExposingAggregationOperation { /** * @return the {@link ExposedFields} derived from {@link Output}. */ - protected ExposedFields asExposedFields() { + ExposedFields asExposedFields() { ExposedFields fields = ExposedFields.from(); @@ -164,7 +161,7 @@ public class FacetOperation implements FieldsExposingAggregationOperation { return fields; } - protected DBObject toDBObject(AggregationOperationContext context) { + DBObject toDBObject(AggregationOperationContext context) { DBObject dbObject = new BasicDBObject(facets.size()); @@ -177,12 +174,12 @@ public class FacetOperation implements FieldsExposingAggregationOperation { /** * Adds a facet to this {@link Facets}. - * + * * @param fieldName must not be {@literal null}. * @param operations must not be {@literal null}. * @return the new {@link Facets}. */ - public Facets and(String fieldName, List operations) { + Facets and(String fieldName, List operations) { Assert.hasText(fieldName, "FieldName must not be null or empty!"); Assert.notNull(operations, "AggregationOperations must not be null!"); @@ -197,7 +194,7 @@ public class FacetOperation implements FieldsExposingAggregationOperation { /** * A single facet with a {@link ExposedField} and its {@link AggregationOperation} pipeline. - * + * * @author Mark Paluch */ private static class Facet { @@ -207,11 +204,11 @@ public class FacetOperation implements FieldsExposingAggregationOperation { /** * Creates a new {@link Facet} given {@link ExposedField} and {@link AggregationOperation} pipeline. - * + * * @param exposedField must not be {@literal null}. * @param operations must not be {@literal null}. */ - protected Facet(ExposedField exposedField, List operations) { + Facet(ExposedField exposedField, List operations) { Assert.notNull(exposedField, "ExposedField must not be null!"); Assert.notNull(operations, "AggregationOperations must not be null!"); @@ -220,11 +217,11 @@ public class FacetOperation implements FieldsExposingAggregationOperation { this.operations = operations; } - protected ExposedField getExposedField() { + ExposedField getExposedField() { return exposedField; } - protected List toDBObjects(AggregationOperationContext context) { + List toDBObjects(AggregationOperationContext context) { return AggregationOperationRenderer.toDBObject(operations, context); } } diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperationUnitTests.java index 77388af89..19459dc09 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketAutoOperationUnitTests.java @@ -28,7 +28,7 @@ import com.mongodb.util.JSON; /** * Unit tests for {@link BucketAutoOperation}. - * + * * @author Mark Paluch */ public class BucketAutoOperationUnitTests { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketOperationUnitTests.java index 5915c73b5..c978f37c1 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/BucketOperationUnitTests.java @@ -29,7 +29,7 @@ import com.mongodb.util.JSON; /** * Unit tests for {@link BucketOperation}. - * + * * @author Mark Paluch */ public class BucketOperationUnitTests { diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FacetOperationUnitTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FacetOperationUnitTests.java index ee40128d5..228102b7c 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FacetOperationUnitTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/aggregation/FacetOperationUnitTests.java @@ -27,7 +27,7 @@ import com.mongodb.util.JSON; /** * Unit tests for {@link FacetOperation}. - * + * * @author Mark Paluch * @soundtrack Stanley Foort - You Make Me Believe In Magic (Extended Mix) */