From 81f85b8cca49ab5efea3639fd40a2b52b867ae7b Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 14 Sep 2022 11:22:23 +0200 Subject: [PATCH] Polishing. Tweak Javadoc, make ViewOptions.collation final. See: #2594 Original pull request: #4142. --- .../data/mongodb/core/MongoOperations.java | 20 ++++++++-------- .../mongodb/core/ReactiveMongoOperations.java | 23 ++++++++++--------- .../data/mongodb/core/ViewOptions.java | 4 ++-- .../mongodb/core/MongoTemplateViewTests.java | 2 ++ 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java index a311742a5..db288ea27 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java @@ -283,9 +283,9 @@ public interface MongoOperations extends FluentMongoOperations { MongoCollection createCollection(String collectionName, @Nullable CollectionOptions collectionOptions); /** - * Create a view with the the provided name whose contents are defined by the {@link AggregationOperation pipeline + * Create a view with the provided name. The view content is defined by the {@link AggregationOperation pipeline * stages} on another collection or view identified by the given {@link #getCollectionName(Class) source type}. - * + * * @param name the name of the view to create. * @param source the type defining the views source collection. * @param stages the {@link AggregationOperation aggregation pipeline stages} defining the view content. @@ -296,7 +296,7 @@ public interface MongoOperations extends FluentMongoOperations { } /** - * Create a view with the the provided name whose contents are defined by the {@link AggregationPipeline pipeline} on + * Create a view with the provided name. The view content is defined by the {@link AggregationPipeline pipeline} on * another collection or view identified by the given {@link #getCollectionName(Class) source type}. * * @param name the name of the view to create. @@ -309,7 +309,7 @@ public interface MongoOperations extends FluentMongoOperations { } /** - * Create a view with the the provided name whose contents are defined by the {@link AggregationPipeline pipeline} on + * Create a view with the provided name. The view content is defined by the {@link AggregationPipeline pipeline} on * another collection or view identified by the given {@link #getCollectionName(Class) source type}. * * @param name the name of the view to create. @@ -321,7 +321,7 @@ public interface MongoOperations extends FluentMongoOperations { MongoCollection createView(String name, Class source, AggregationPipeline pipeline, @Nullable ViewOptions options); /** - * Create a view with the the provided name whose contents are defined by the {@link AggregationPipeline pipeline} on + * Create a view with the provided name. The view content is defined by the {@link AggregationPipeline pipeline} on * another collection or view identified by the given source. * * @param name the name of the view to create. @@ -1593,7 +1593,7 @@ public interface MongoOperations extends FluentMongoOperations { DeleteResult remove(Object object, String collectionName); /** - * Remove all documents that match the provided query document criteria from the the collection used to store the + * Remove all documents that match the provided query document criteria from the collection used to store the * entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the query. * * @param query the query document that specifies the criteria used to remove a record. @@ -1604,7 +1604,7 @@ public interface MongoOperations extends FluentMongoOperations { DeleteResult remove(Query query, Class entityClass); /** - * Remove all documents that match the provided query document criteria from the the collection used to store the + * Remove all documents that match the provided query document criteria from the collection used to store the * entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the query. * * @param query the query document that specifies the criteria used to remove a record. @@ -1652,9 +1652,9 @@ public interface MongoOperations extends FluentMongoOperations { List findAllAndRemove(Query query, Class entityClass); /** - * Returns and removes all documents that match the provided query document criteria from the the collection used to - * store the entityClass. The Class parameter is also used to help convert the Id of the object if it is present in - * the query. + * Returns and removes all documents that match the provided query document criteria from the collection used to store + * the entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the + * query. * * @param query the query document that specifies the criteria used to find and remove documents. * @param entityClass class of the pojo to be operated on. diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java index 256f9b4b6..a76ba264b 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoOperations.java @@ -15,8 +15,6 @@ */ package org.springframework.data.mongodb.core; -import org.springframework.data.mongodb.core.aggregation.AggregationOperation; -import org.springframework.data.mongodb.core.aggregation.AggregationPipeline; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -27,10 +25,13 @@ import java.util.function.Supplier; import org.bson.Document; import org.reactivestreams.Publisher; import org.reactivestreams.Subscription; + import org.springframework.data.geo.GeoResult; import org.springframework.data.mongodb.ReactiveMongoDatabaseFactory; import org.springframework.data.mongodb.core.aggregation.Aggregation; +import org.springframework.data.mongodb.core.aggregation.AggregationOperation; import org.springframework.data.mongodb.core.aggregation.AggregationOptions; +import org.springframework.data.mongodb.core.aggregation.AggregationPipeline; import org.springframework.data.mongodb.core.aggregation.AggregationUpdate; import org.springframework.data.mongodb.core.aggregation.TypedAggregation; import org.springframework.data.mongodb.core.convert.MappingMongoConverter; @@ -243,7 +244,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { Mono> createCollection(String collectionName, CollectionOptions collectionOptions); /** - * Create a view with the the provided name whose contents are defined by the {@link AggregationOperation pipeline + * Create a view with the provided name. The view content is defined by the {@link AggregationOperation pipeline * stages} on another collection or view identified by the given {@link #getCollectionName(Class) source type}. * * @param name the name of the view to create. @@ -256,7 +257,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { } /** - * Create a view with the the provided name whose contents are defined by the {@link AggregationPipeline pipeline} on + * Create a view with the provided name. The view content is defined by the {@link AggregationPipeline pipeline} on * another collection or view identified by the given {@link #getCollectionName(Class) source type}. * * @param name the name of the view to create. @@ -269,7 +270,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { } /** - * Create a view with the the provided name whose contents are defined by the {@link AggregationPipeline pipeline} on + * Create a view with the provided name. The view content is defined by the {@link AggregationPipeline pipeline} on * another collection or view identified by the given {@link #getCollectionName(Class) source type}. * * @param name the name of the view to create. @@ -281,7 +282,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { Mono> createView(String name, Class source, AggregationPipeline pipeline, @Nullable ViewOptions options); /** - * Create a view with the the provided name whose contents are defined by the {@link AggregationPipeline pipeline} on + * Create a view with the provided name. The view content is defined by the {@link AggregationPipeline pipeline} on * another collection or view identified by the given source. * * @param name the name of the view to create. @@ -1445,7 +1446,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { Mono remove(Mono objectToRemove, String collectionName); /** - * Remove all documents that match the provided query document criteria from the the collection used to store the + * Remove all documents that match the provided query document criteria from the collection used to store the * entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the query. * * @param query the query document that specifies the criteria used to remove a record. @@ -1455,7 +1456,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { Mono remove(Query query, Class entityClass); /** - * Remove all documents that match the provided query document criteria from the the collection used to store the + * Remove all documents that match the provided query document criteria from the collection used to store the * entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the query. * * @param query the query document that specifies the criteria used to remove a record. @@ -1498,9 +1499,9 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { Flux findAllAndRemove(Query query, Class entityClass); /** - * Returns and removes all documents that match the provided query document criteria from the the collection used to - * store the entityClass. The Class parameter is also used to help convert the Id of the object if it is present in - * the query. + * Returns and removes all documents that match the provided query document criteria from the collection used to store + * the entityClass. The Class parameter is also used to help convert the Id of the object if it is present in the + * query. * * @param query the query document that specifies the criteria used to find and remove documents. * @param entityClass class of the pojo to be operated on. diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ViewOptions.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ViewOptions.java index 88f20f87a..da17ef5db 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ViewOptions.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ViewOptions.java @@ -23,13 +23,13 @@ import org.springframework.lang.Nullable; /** * Immutable object holding additional options to be applied when creating a MongoDB * views. - * + * * @author Christoph Strobl * @since 4.0 */ public class ViewOptions { - @Nullable private Collation collation; + private final @Nullable Collation collation; static ViewOptions none() { return new ViewOptions(); diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateViewTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateViewTests.java index bbb06eef4..80ccf3e29 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateViewTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateViewTests.java @@ -41,6 +41,8 @@ import org.springframework.data.mongodb.test.util.MongoTestUtils; import com.mongodb.client.MongoClient; /** + * Integration tests for Views. + * * @author Christoph Strobl */ @ExtendWith(MongoClientExtension.class)