diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/LazyLoadingException.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/LazyLoadingException.java index 67ca617d1..0ec364f6c 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/LazyLoadingException.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/LazyLoadingException.java @@ -25,8 +25,10 @@ public class LazyLoadingException extends UncategorizedDataAccessException { private static final long serialVersionUID = -7089224903873220037L; /** - * @param msg - * @param cause + * Constructor for LazyLoadingException. + * + * @param msg the detail message. + * @param cause the exception thrown by underlying data access API. */ public LazyLoadingException(String msg, Throwable cause) { super(msg, cause); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/MongoDatabaseFactory.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/MongoDatabaseFactory.java index 846a52727..96620d8f8 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/MongoDatabaseFactory.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/MongoDatabaseFactory.java @@ -45,7 +45,7 @@ public interface MongoDatabaseFactory extends CodecRegistryProvider, MongoSessio /** * Obtain a {@link MongoDatabase} instance to access the database with the given name. * - * @param dbName + * @param dbName must not be {@literal null}. * @return never {@literal null}. * @throws DataAccessException */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/MongoDbFactory.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/MongoDbFactory.java index 97d2c7d0c..aa46fbc88 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/MongoDbFactory.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/MongoDbFactory.java @@ -33,7 +33,7 @@ public interface MongoDbFactory extends MongoDatabaseFactory { /** * Creates a default {@link MongoDatabase} instance. * - * @return + * @return never {@literal null}. * @throws DataAccessException * @deprecated since 3.0. Use {@link #getMongoDatabase()} instead. */ @@ -46,7 +46,7 @@ public interface MongoDbFactory extends MongoDatabaseFactory { * Obtain a {@link MongoDatabase} instance to access the database with the given name. * * @param dbName must not be {@literal null} or empty. - * @return + * @return never {@literal null}. * @throws DataAccessException * @deprecated since 3.0. Use {@link #getMongoDatabase(String)} instead. */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/ReactiveMongoDatabaseFactory.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/ReactiveMongoDatabaseFactory.java index d673fd98c..6a54e94e6 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/ReactiveMongoDatabaseFactory.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/ReactiveMongoDatabaseFactory.java @@ -39,7 +39,7 @@ public interface ReactiveMongoDatabaseFactory extends CodecRegistryProvider { /** * Creates a default {@link MongoDatabase} instance. * - * @return + * @return never {@literal null}. * @throws DataAccessException */ Mono getMongoDatabase() throws DataAccessException; @@ -48,7 +48,7 @@ public interface ReactiveMongoDatabaseFactory extends CodecRegistryProvider { * Obtain a {@link MongoDatabase} instance to access the database with the given name. * * @param dbName must not be {@literal null} or empty. - * @return + * @return never {@literal null}. * @throws DataAccessException */ Mono getMongoDatabase(String dbName) throws DataAccessException; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/EnableMongoAuditing.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/EnableMongoAuditing.java index 82d9c4fa0..98bd186da 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/EnableMongoAuditing.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/EnableMongoAuditing.java @@ -42,21 +42,21 @@ public @interface EnableMongoAuditing { /** * Configures the {@link AuditorAware} bean to be used to lookup the current principal. * - * @return + * @return empty {@link String} by default. */ String auditorAwareRef() default ""; /** * Configures whether the creation and modification dates are set. Defaults to {@literal true}. * - * @return + * @return {@literal true} by default. */ boolean setDates() default true; /** * Configures whether the entity shall be marked as modified on creation. Defaults to {@literal true}. * - * @return + * @return {@literal true} by default. */ boolean modifyOnCreate() default true; @@ -64,7 +64,7 @@ public @interface EnableMongoAuditing { * Configures a {@link DateTimeProvider} bean name that allows customizing the {@link org.joda.time.DateTime} to be * used for setting creation and modification dates. * - * @return + * @return empty {@link String} by default. */ String dateTimeProviderRef() default ""; } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/MongoConfigurationSupport.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/MongoConfigurationSupport.java index e946af8c5..a96617de4 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/MongoConfigurationSupport.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/MongoConfigurationSupport.java @@ -95,7 +95,7 @@ public abstract class MongoConfigurationSupport { /** * Register custom {@link Converter}s in a {@link CustomConversions} object if required. These * {@link CustomConversions} will be registered with the - * {@link org.springframework.data.mongodb.core.convert.MappingMongoConverter} and {@link #mongoMappingContext()}. + * {@link org.springframework.data.mongodb.core.convert.MappingMongoConverter} and {@link MongoMappingContext}. * Returns an empty {@link MongoCustomConversions} instance by default. *

* NOTE: Use {@link #configureConverters(MongoConverterConfigurationAdapter)} to configure MongoDB diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/BulkOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/BulkOperations.java index 11b6ff3e0..bbc85032e 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/BulkOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/BulkOperations.java @@ -94,7 +94,6 @@ public interface BulkOperations { * Add a list of updates to the bulk operation. For each update request, all matching documents are updated. * * @param updates Update operations to perform. - * @return The bulk operation. * @return the current {@link BulkOperations} instance with the update added, will never be {@literal null}. */ BulkOperations updateMulti(List> updates); @@ -105,7 +104,6 @@ public interface BulkOperations { * * @param query Update criteria. * @param update Update operation to perform. - * @return The bulk operation. * @return the current {@link BulkOperations} instance with the update added, will never be {@literal null}. */ BulkOperations upsert(Query query, Update update); @@ -115,7 +113,6 @@ public interface BulkOperations { * else an insert. * * @param updates Updates/insert operations to perform. - * @return The bulk operation. * @return the current {@link BulkOperations} instance with the update added, will never be {@literal null}. */ BulkOperations upsert(List> updates); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionCallback.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionCallback.java index b5e51613a..d6b9bcc6e 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionCallback.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionCallback.java @@ -29,7 +29,7 @@ import com.mongodb.client.MongoCollection; * @author Grame Rocher * @author Oliver Gierke * @author John Brisbin - * @auhtor Christoph Strobl + * @author Christoph Strobl * @since 1.0 */ public interface CollectionCallback { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionOptions.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionOptions.java index d9338e0f3..77833c6ad 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionOptions.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionOptions.java @@ -95,7 +95,7 @@ public class CollectionOptions { /** * Create new {@link CollectionOptions} with already given settings and capped set to {@literal true}.
- * NOTE Using capped collections requires defining {@link #size(int)}. + * NOTE Using capped collections requires defining {@link #size(long)}. * * @return new {@link CollectionOptions}. * @since 2.0 diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CursorPreparer.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CursorPreparer.java index a9ce9427c..bb98bb96b 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CursorPreparer.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CursorPreparer.java @@ -43,9 +43,10 @@ public interface CursorPreparer extends ReadPreferenceAware { /** * Prepare the given cursor (apply limits, skips and so on). Returns the prepared cursor. * - * @param cursor + * @param iterable must not be {@literal null}. + * @return never {@literal null}. */ - FindIterable prepare(FindIterable cursor); + FindIterable prepare(FindIterable iterable); /** * Apply query specific settings to {@link MongoCollection} and initate a find operation returning a @@ -53,7 +54,7 @@ public interface CursorPreparer extends ReadPreferenceAware { * * @param collection must not be {@literal null}. * @param find must not be {@literal null}. - * @return + * @return never {@literal null}. * @throws IllegalArgumentException if one of the required arguments is {@literal null}. * @since 2.2 */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DocumentCallbackHandler.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DocumentCallbackHandler.java index 1a002392b..aa9706370 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DocumentCallbackHandler.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DocumentCallbackHandler.java @@ -23,7 +23,7 @@ import com.mongodb.MongoException; /** * An interface used by {@link MongoTemplate} for processing documents returned from a MongoDB query on a per-document * basis. Implementations of this interface perform the actual work of prcoessing each document but don't need to worry - * about exception handling. {@MongoException}s will be caught and translated by the calling MongoTemplate An + * about exception handling. {@link MongoException}s will be caught and translated by the calling MongoTemplate An * DocumentCallbackHandler is typically stateful: It keeps the result state within the object, to be available later for * later inspection. * diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/EntityOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/EntityOperations.java index 5382b70c0..a7cbf879e 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/EntityOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/EntityOperations.java @@ -66,7 +66,7 @@ class EntityOperations { * Creates a new {@link Entity} for the given bean. * * @param entity must not be {@literal null}. - * @return + * @return new instance of {@link Entity}. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Entity forEntity(T entity) { @@ -89,7 +89,7 @@ class EntityOperations { * * @param entity must not be {@literal null}. * @param conversionService must not be {@literal null}. - * @return + * @return new instance of {@link AdaptibleEntity}. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public AdaptibleEntity forEntity(T entity, ConversionService conversionService) { @@ -108,6 +108,10 @@ class EntityOperations { return AdaptibleMappedEntity.of(entity, context, conversionService); } + /** + * @param entityClass should not be null. + * @return the {@link MongoPersistentEntity#getCollection() collection name}. + */ public String determineCollectionName(@Nullable Class entityClass) { if (entityClass == null) { @@ -138,7 +142,7 @@ class EntityOperations { * {@code _id} if no identifier property can be found. * * @param type must not be {@literal null}. - * @return + * @return never {@literal null}. */ public String getIdPropertyName(Class type) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableAggregationOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableAggregationOperation.java index 329989818..4e9bec35e 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableAggregationOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableAggregationOperation.java @@ -88,9 +88,9 @@ public interface ExecutableAggregationOperation { /** * Apply pipeline operations as specified and stream all matching elements.
- * Returns a {@link CloseableIterator} that wraps the a Mongo DB {@link com.mongodb.Cursor} + * Returns a {@link CloseableIterator} that wraps the a Mongo DB {@link com.mongodb.client.FindIterable} * - * @return a {@link CloseableIterator} that wraps the a Mongo DB {@link com.mongodb.Cursor} that needs to be closed. + * @return a {@link CloseableIterator} that wraps the a Mongo DB {@link com.mongodb.client.FindIterable} that needs to be closed. * Never {@literal null}. */ CloseableIterator stream(); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperation.java index b2d4e729e..3bd63bb4f 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperation.java @@ -118,7 +118,7 @@ public interface ExecutableFindOperation { /** * Stream all matching elements. * - * @return a {@link Stream} that wraps the a Mongo DB {@link com.mongodb.Cursor} that needs to be closed. Never + * @return a {@link Stream} that wraps the a Mongo DB {@link com.mongodb.client.FindIterable} that needs to be closed. Never * {@literal null}. */ Stream stream(); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperationSupport.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperationSupport.java index d27fdfac7..eac01e529 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperationSupport.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperationSupport.java @@ -257,9 +257,9 @@ class ExecutableFindOperationSupport implements ExecutableFindOperation { * @see org.springframework.data.mongodb.core.CursorPreparer#prepare(com.mongodb.clientFindIterable) */ @Override - public FindIterable prepare(FindIterable cursor) { + public FindIterable prepare(FindIterable iterable) { - FindIterable target = delegate != null ? delegate.prepare(cursor) : cursor; + FindIterable target = delegate != null ? delegate.prepare(iterable) : iterable; return limit.map(target::limit).orElse(target); } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndModifyOptions.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndModifyOptions.java index d7fac7ab9..ac8f45d05 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndModifyOptions.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndModifyOptions.java @@ -78,7 +78,7 @@ public class FindAndModifyOptions { } /** - * Create new {@link FindAndModifyOptions} based on option of given {@litearl source}. + * Create new {@link FindAndModifyOptions} based on option of given {@literal source}. * * @param source can be {@literal null}. * @return new instance of {@link FindAndModifyOptions}. @@ -117,8 +117,8 @@ public class FindAndModifyOptions { /** * Define the {@link Collation} specifying language-specific rules for string comparison. * - * @param collation - * @return + * @param collation can be {@literal null}. + * @return this. * @since 2.0 */ public FindAndModifyOptions collation(@Nullable Collation collation) { @@ -142,7 +142,7 @@ public class FindAndModifyOptions { /** * Get the {@link Collation} specifying language-specific rules for string comparison. * - * @return + * @return never {@literal null}. * @since 2.0 */ public Optional getCollation() { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndReplaceOptions.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndReplaceOptions.java index 379015cd8..2de66015c 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndReplaceOptions.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndReplaceOptions.java @@ -116,7 +116,7 @@ public class FindAndReplaceOptions { /** * Get the bit indicating to return the replacement document. * - * @return + * @return {@literal true} if set. */ public boolean isReturnNew() { return returnNew; @@ -125,7 +125,7 @@ public class FindAndReplaceOptions { /** * Get the bit indicating if to create a new document if not exists. * - * @return + * @return {@literal true} if set. */ public boolean isUpsert() { return upsert; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindPublisherPreparer.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindPublisherPreparer.java index ddf1b4e37..3f603f9f4 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindPublisherPreparer.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindPublisherPreparer.java @@ -54,7 +54,7 @@ public interface FindPublisherPreparer extends ReadPreferenceAware { * * @param collection must not be {@literal null}. * @param find must not be {@literal null}. - * @return + * @return never {@literal null}. * @throws IllegalArgumentException if one of the required arguments is {@literal null}. * @since 2.2 */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/GeoCommandStatistics.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/GeoCommandStatistics.java index ddd1216b3..0d3b64828 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/GeoCommandStatistics.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/GeoCommandStatistics.java @@ -47,7 +47,7 @@ class GeoCommandStatistics { * Creates a new {@link GeoCommandStatistics} from the given command result extracting the statistics. * * @param commandResult must not be {@literal null}. - * @return + * @return never {@literal null}. */ public static GeoCommandStatistics from(Document commandResult) { @@ -61,7 +61,7 @@ class GeoCommandStatistics { * Returns the average distance reported by the command result. Mitigating a removal of the field in case the command * didn't return any result introduced in MongoDB 3.2 RC1. * - * @return + * @return never {@literal null}, uses {@link Double#NaN} if {@literal avgDistance} does not exist. * @see MongoDB Jira SERVER-21024 */ public double getAverageDistance() { 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 0ec065c2d..bb6c402fb 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 @@ -79,7 +79,7 @@ public interface MongoOperations extends FluentMongoOperations { * The collection name used for the specified class by this template. * * @param entityClass must not be {@literal null}. - * @return + * @return never {@literal null}. */ String getCollectionName(Class entityClass); @@ -363,7 +363,7 @@ public interface MongoOperations extends FluentMongoOperations { /** * Returns the {@link ScriptOperations} that can be performed on {@link com.mongodb.client.MongoDatabase} level. * - * @return + * @return never {@literal null}. * @since 1.7 * @deprecated since 2.2. The {@code eval} command has been removed without replacement in MongoDB Server 4.2.0. */ @@ -1557,7 +1557,7 @@ public interface MongoOperations extends FluentMongoOperations { /** * Returns the underlying {@link MongoConverter}. * - * @return + * @return never {@literal null}. */ MongoConverter getConverter(); } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java index 9d10d4fc0..b70ddcbb6 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java @@ -3199,9 +3199,9 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, * (non-Javadoc) * @see org.springframework.data.mongodb.core.CursorPreparer#prepare(com.mongodb.DBCursor) */ - public FindIterable prepare(FindIterable cursor) { + public FindIterable prepare(FindIterable iterable) { - FindIterable cursorToUse = cursor; + FindIterable cursorToUse = iterable; operations.forType(type).getCollation(query) // .map(Collation::toMongoCollation) // 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 58d1fa115..9bf4514b3 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 @@ -1239,7 +1239,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { * domain type information. Use {@link #updateFirst(Query, UpdateDefinition, Class, String)} to get full type specific * support.
* NOTE: {@link Query#getSortObject() sorting} is not supported by {@code db.collection.updateOne}. - * Use {@link #findAndModify(Query, Update, Class, String)} instead. + * Use {@link #findAndModify(Query, UpdateDefinition, Class, String)} instead. * * @param query the query document that specifies the criteria used to select a record to be updated. Must not be * {@literal null}. @@ -1572,7 +1572,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { /** * Returns the underlying {@link MongoConverter}. * - * @return + * @return never {@literal null}. */ MongoConverter getConverter(); @@ -1580,7 +1580,7 @@ public interface ReactiveMongoOperations extends ReactiveFluentMongoOperations { * The collection name used for the specified class by this template. * * @param entityClass must not be {@literal null}. - * @return + * @return never {@literal null}. * @since 2.1 */ String getCollectionName(Class entityClass); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java index 67eec6594..9bfcc533f 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java @@ -319,8 +319,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati /** * Configures the {@link WriteConcern} to be used with the template. If none is configured the {@link WriteConcern} - * configured on the {@link MongoDatabaseFactory} will apply. If you configured a {@link Mongo} instance no - * {@link WriteConcern} will be used. + * configured on the {@link MongoDatabaseFactory} will apply. * * @param writeConcern can be {@literal null}. */ @@ -2411,7 +2410,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati * @param query the query document that specifies the criteria used to find a record. * @param fields the document that specifies the fields to be returned. * @param entityClass the parameterized type of the returned list. - * @param preparer allows for customization of the {@link DBCursor} used when iterating over the result set, (apply + * @param preparer allows for customization of the {@link com.mongodb.client.FindIterable} used when iterating over the result set, (apply * limits, skips and so on). * @return the {@link List} of converted objects. */ @@ -2842,7 +2841,7 @@ public class ReactiveMongoTemplate implements ReactiveMongoOperations, Applicati /** * Simple {@link ReactiveCollectionCallback} that takes a query {@link Document} plus an optional fields specification - * {@link Document} and executes that against the {@link DBCollection}. + * {@link Document} and executes that against the {@link MongoCollection}. * * @author Oliver Gierke * @author Thomas Risberg diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/WriteResultChecking.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/WriteResultChecking.java index ceffe9e8d..3183bf92b 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/WriteResultChecking.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/WriteResultChecking.java @@ -16,8 +16,8 @@ package org.springframework.data.mongodb.core; /** - * Enum to represent how strict the check of {@link com.mongodb.WriteResult} shall be. It can either be skipped entirely - * (use {@link #NONE}) or cause an exception to be thrown {@link #EXCEPTION}. + * Enum to represent how strict the check of {@link com.mongodb.WriteConcernResult} shall be. It can either be skipped + * entirely (use {@link #NONE}) or cause an exception to be thrown {@link #EXCEPTION}. * * @author Thomas Risberg * @author Oliver Gierke diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperators.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperators.java index d1a7c01a1..c9a5a73c3 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperators.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AccumulatorOperators.java @@ -34,7 +34,7 @@ public class AccumulatorOperators { * Take the numeric value referenced by given {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link AccumulatorOperatorFactory}. */ public static AccumulatorOperatorFactory valueOf(String fieldReference) { return new AccumulatorOperatorFactory(fieldReference); @@ -44,7 +44,7 @@ public class AccumulatorOperators { * Take the numeric value referenced resulting from given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link AccumulatorOperatorFactory}. */ public static AccumulatorOperatorFactory valueOf(AggregationExpression expression) { return new AccumulatorOperatorFactory(expression); @@ -86,7 +86,7 @@ public class AccumulatorOperators { * Creates new {@link AggregationExpression} that takes the associated numeric value expression and calculates and * returns the sum. * - * @return + * @return new instance of {@link Sum}. */ public Sum sum() { return usesFieldRef() ? Sum.sumOf(fieldReference) : Sum.sumOf(expression); @@ -96,7 +96,7 @@ public class AccumulatorOperators { * Creates new {@link AggregationExpression} that takes the associated numeric value expression and returns the * average value. * - * @return + * @return new instance of {@link Avg}. */ public Avg avg() { return usesFieldRef() ? Avg.avgOf(fieldReference) : Avg.avgOf(expression); @@ -106,7 +106,7 @@ public class AccumulatorOperators { * Creates new {@link AggregationExpression} that takes the associated numeric value expression and returns the * maximum value. * - * @return + * @return new instance of {@link Max}. */ public Max max() { return usesFieldRef() ? Max.maxOf(fieldReference) : Max.maxOf(expression); @@ -116,7 +116,7 @@ public class AccumulatorOperators { * Creates new {@link AggregationExpression} that takes the associated numeric value expression and returns the * minimum value. * - * @return + * @return new instance of {@link Min}. */ public Min min() { return usesFieldRef() ? Min.minOf(fieldReference) : Min.minOf(expression); @@ -126,7 +126,7 @@ public class AccumulatorOperators { * Creates new {@link AggregationExpression} that takes the associated numeric value expression and calculates the * population standard deviation of the input values. * - * @return + * @return new instance of {@link StdDevPop}. */ public StdDevPop stdDevPop() { return usesFieldRef() ? StdDevPop.stdDevPopOf(fieldReference) : StdDevPop.stdDevPopOf(expression); @@ -136,7 +136,7 @@ public class AccumulatorOperators { * Creates new {@link AggregationExpression} that takes the associated numeric value expression and calculates the * sample standard deviation of the input values. * - * @return + * @return new instance of {@link StdDevSamp}. */ public StdDevSamp stdDevSamp() { return usesFieldRef() ? StdDevSamp.stdDevSampOf(fieldReference) : StdDevSamp.stdDevSampOf(expression); @@ -167,7 +167,7 @@ public class AccumulatorOperators { * Creates new {@link Sum}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Sum}. */ public static Sum sumOf(String fieldReference) { @@ -179,7 +179,7 @@ public class AccumulatorOperators { * Creates new {@link Sum}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Sum}. */ public static Sum sumOf(AggregationExpression expression) { @@ -192,7 +192,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Sum}. */ public Sum and(String fieldReference) { @@ -205,7 +205,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Sum}. */ public Sum and(AggregationExpression expression) { @@ -264,7 +264,7 @@ public class AccumulatorOperators { * Creates new {@link Avg}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Avg}. */ public static Avg avgOf(String fieldReference) { @@ -276,7 +276,7 @@ public class AccumulatorOperators { * Creates new {@link Avg}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Avg}. */ public static Avg avgOf(AggregationExpression expression) { @@ -289,7 +289,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Avg}. */ public Avg and(String fieldReference) { @@ -302,7 +302,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Avg}. */ public Avg and(AggregationExpression expression) { @@ -347,7 +347,7 @@ public class AccumulatorOperators { * Creates new {@link Max}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Max}. */ public static Max maxOf(String fieldReference) { @@ -359,7 +359,7 @@ public class AccumulatorOperators { * Creates new {@link Max}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Max}. */ public static Max maxOf(AggregationExpression expression) { @@ -372,7 +372,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Max}. */ public Max and(String fieldReference) { @@ -385,7 +385,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Max}. */ public Max and(AggregationExpression expression) { @@ -430,7 +430,7 @@ public class AccumulatorOperators { * Creates new {@link Min}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Min}. */ public static Min minOf(String fieldReference) { @@ -442,7 +442,7 @@ public class AccumulatorOperators { * Creates new {@link Min}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Min}. */ public static Min minOf(AggregationExpression expression) { @@ -455,7 +455,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Min}. */ public Min and(String fieldReference) { @@ -468,7 +468,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Min}. */ public Min and(AggregationExpression expression) { @@ -513,7 +513,7 @@ public class AccumulatorOperators { * Creates new {@link StdDevPop}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link StdDevPop}. */ public static StdDevPop stdDevPopOf(String fieldReference) { @@ -525,7 +525,7 @@ public class AccumulatorOperators { * Creates new {@link StdDevPop} with all previously added arguments appending the given one. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link StdDevPop}. */ public static StdDevPop stdDevPopOf(AggregationExpression expression) { @@ -538,7 +538,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link StdDevPop}. */ public StdDevPop and(String fieldReference) { @@ -551,7 +551,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link StdDevPop}. */ public StdDevPop and(AggregationExpression expression) { @@ -596,7 +596,7 @@ public class AccumulatorOperators { * Creates new {@link StdDevSamp}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link StdDevSamp}. */ public static StdDevSamp stdDevSampOf(String fieldReference) { @@ -608,7 +608,7 @@ public class AccumulatorOperators { * Creates new {@link StdDevSamp}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link StdDevSamp}. */ public static StdDevSamp stdDevSampOf(AggregationExpression expression) { @@ -621,7 +621,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link StdDevSamp}. */ public StdDevSamp and(String fieldReference) { @@ -634,7 +634,7 @@ public class AccumulatorOperators { * NOTE: Only possible in {@code $project} stage. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link StdDevSamp}. */ public StdDevSamp and(AggregationExpression expression) { 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 8a29c0dfc..912897741 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 @@ -133,7 +133,7 @@ public class Aggregation { * supported in MongoDB version 2.6+. * * @param options must not be {@literal null}. - * @return + * @return new instance of {@link Aggregation}. * @since 1.6 */ public Aggregation withOptions(AggregationOptions options) { @@ -259,7 +259,7 @@ public class Aggregation { * Creates a new {@link ProjectionOperation} including the given fields. * * @param fields must not be {@literal null}. - * @return + * @return new instance of {@link ProjectionOperation}. */ public static ProjectionOperation project(String... fields) { return project(fields(fields)); @@ -269,7 +269,7 @@ public class Aggregation { * Creates a new {@link ProjectionOperation} including the given {@link Fields}. * * @param fields must not be {@literal null}. - * @return + * @return new instance of {@link ProjectionOperation}. */ public static ProjectionOperation project(Fields fields) { return new ProjectionOperation(fields); @@ -292,7 +292,7 @@ public class Aggregation { * Factory method to create a new {@link UnwindOperation} for the field with the given name. * * @param field must not be {@literal null} or empty. - * @return + * @return new instance of {@link UnwindOperation}. */ public static UnwindOperation unwind(String field) { return new UnwindOperation(field(field)); @@ -302,7 +302,7 @@ public class Aggregation { * Factory method to create a new {@link ReplaceRootOperation} for the field with the given name. * * @param fieldName must not be {@literal null} or empty. - * @return + * @return new instance of {@link ReplaceRootOperation}. * @since 1.10 */ public static ReplaceRootOperation replaceRoot(String fieldName) { @@ -314,7 +314,7 @@ public class Aggregation { * {@link AggregationExpression}. * * @param aggregationExpression must not be {@literal null}. - * @return + * @return new instance of {@link ReplaceRootOperation}. * @since 1.10 */ public static ReplaceRootOperation replaceRoot(AggregationExpression aggregationExpression) { @@ -380,7 +380,7 @@ public class Aggregation { * Creates a new {@link GroupOperation} for the given fields. * * @param fields must not be {@literal null}. - * @return + * @return new instance of {@link GroupOperation}. */ public static GroupOperation group(String... fields) { return group(fields(fields)); @@ -401,7 +401,7 @@ public class Aggregation { * {@link GraphLookupOperation} given {@literal fromCollection}. * * @param fromCollection must not be {@literal null} or empty. - * @return + * @return new instance of {@link StartWithBuilder} for creating a {@link GraphLookupOperation}. * @since 1.10 */ public static StartWithBuilder graphLookup(String fromCollection) { @@ -412,7 +412,7 @@ public class Aggregation { * Factory method to create a new {@link SortOperation} for the given {@link Sort}. * * @param sort must not be {@literal null}. - * @return + * @return new instance of {@link SortOperation}. */ public static SortOperation sort(Sort sort) { return new SortOperation(sort); @@ -423,7 +423,7 @@ public class Aggregation { * * @param direction must not be {@literal null}. * @param fields must not be {@literal null}. - * @return + * @return new instance of {@link SortOperation}. */ public static SortOperation sort(Direction direction, String... fields) { return new SortOperation(Sort.by(direction, fields)); @@ -433,7 +433,7 @@ public class Aggregation { * Creates a new {@link SortByCountOperation} given {@literal groupByField}. * * @param field must not be {@literal null} or empty. - * @return + * @return new instance of {@link SortByCountOperation}. * @since 2.1 */ public static SortByCountOperation sortByCount(String field) { @@ -444,7 +444,7 @@ public class Aggregation { * Creates a new {@link SortByCountOperation} given {@link AggregationExpression group and sort expression}. * * @param groupAndSortExpression must not be {@literal null}. - * @return + * @return new instance of {@link SortByCountOperation}. * @since 2.1 */ public static SortByCountOperation sortByCount(AggregationExpression groupAndSortExpression) { @@ -455,9 +455,10 @@ public class Aggregation { * Creates a new {@link SkipOperation} skipping the given number of elements. * * @param elementsToSkip must not be less than zero. - * @return + * @return new instance of {@link SkipOperation}. * @deprecated prepare to get this one removed in favor of {@link #skip(long)}. */ + @Deprecated public static SkipOperation skip(int elementsToSkip) { return new SkipOperation(elementsToSkip); } @@ -466,7 +467,7 @@ public class Aggregation { * Creates a new {@link SkipOperation} skipping the given number of elements. * * @param elementsToSkip must not be less than zero. - * @return + * @return new instance of {@link SkipOperation}. */ public static SkipOperation skip(long elementsToSkip) { return new SkipOperation(elementsToSkip); @@ -476,7 +477,7 @@ public class Aggregation { * Creates a new {@link LimitOperation} limiting the result to the given number of elements. * * @param maxElements must not be less than zero. - * @return + * @return new instance of {@link LimitOperation}. */ public static LimitOperation limit(long maxElements) { return new LimitOperation(maxElements); @@ -486,7 +487,7 @@ public class Aggregation { * Creates a new {@link SampleOperation} to select the specified number of documents from its input randomly. * * @param sampleSize must not be less than zero. - * @return + * @return new instance of {@link SampleOperation}. * @since 2.0 */ public static SampleOperation sample(long sampleSize) { @@ -497,7 +498,7 @@ public class Aggregation { * Creates a new {@link MatchOperation} using the given {@link Criteria}. * * @param criteria must not be {@literal null}. - * @return + * @return new instance of {@link MatchOperation}. */ public static MatchOperation match(Criteria criteria) { return new MatchOperation(criteria); @@ -507,7 +508,7 @@ public class Aggregation { * Creates a new {@link MatchOperation} using the given {@link CriteriaDefinition}. * * @param criteria must not be {@literal null}. - * @return + * @return new instance of {@link MatchOperation}. * @since 1.10 */ public static MatchOperation match(CriteriaDefinition criteria) { @@ -520,7 +521,7 @@ public class Aggregation { * * @param query must not be {@literal null}. * @param distanceField must not be {@literal null} or empty. - * @return + * @return new instance of {@link GeoNearOperation}. * @since 1.7 */ public static GeoNearOperation geoNear(NearQuery query, String distanceField) { @@ -546,7 +547,7 @@ public class Aggregation { * collection in the current database if one does not already exist. The collection is not visible until the * aggregation completes. If the aggregation fails, MongoDB does not create the collection. Must not be * {@literal null}. - * @return + * @return new instance of {@link OutOperation}. */ public static OutOperation out(String outCollectionName) { return new OutOperation(outCollectionName); @@ -556,7 +557,7 @@ public class Aggregation { * Creates a new {@link BucketOperation} given {@literal groupByField}. * * @param groupByField must not be {@literal null} or empty. - * @return + * @return new instance of {@link BucketOperation}. * @since 1.10 */ public static BucketOperation bucket(String groupByField) { @@ -567,7 +568,7 @@ public class Aggregation { * Creates a new {@link BucketOperation} given {@link AggregationExpression group-by expression}. * * @param groupByExpression must not be {@literal null}. - * @return + * @return new instance of {@link BucketOperation}. * @since 1.10 */ public static BucketOperation bucket(AggregationExpression groupByExpression) { @@ -579,7 +580,7 @@ public class Aggregation { * * @param groupByField must not be {@literal null} or empty. * @param buckets number of buckets, must be a positive integer. - * @return + * @return new instance of {@link BucketAutoOperation}. * @since 1.10 */ public static BucketAutoOperation bucketAuto(String groupByField, int buckets) { @@ -591,7 +592,7 @@ public class Aggregation { * * @param groupByExpression must not be {@literal null}. * @param buckets number of buckets, must be a positive integer. - * @return + * @return new instance of {@link BucketAutoOperation}. * @since 1.10 */ public static BucketAutoOperation bucketAuto(AggregationExpression groupByExpression, int buckets) { @@ -601,7 +602,7 @@ public class Aggregation { /** * Creates a new {@link FacetOperation}. * - * @return + * @return new instance of {@link FacetOperation}. * @since 1.10 */ public static FacetOperation facet() { @@ -612,7 +613,7 @@ public class Aggregation { * Creates a new {@link FacetOperationBuilder} given {@link Aggregation}. * * @param aggregationOperations the sub-pipeline, must not be {@literal null}. - * @return + * @return new instance of {@link FacetOperation}. * @since 1.10 */ public static FacetOperationBuilder facet(AggregationOperation... aggregationOperations) { @@ -681,7 +682,7 @@ public class Aggregation { * Creates a new {@link Fields} instance for the given field names. * * @param fields must not be {@literal null}. - * @return + * @return new instance of {@link Fields}. * @see Fields#fields(String...) */ public static Fields fields(String... fields) { @@ -693,7 +694,7 @@ public class Aggregation { * * @param name must not be {@literal null} or empty. * @param target must not be {@literal null} or empty. - * @return + * @return new instance of {@link Fields}. */ public static Fields bind(String name, String target) { return Fields.from(field(name, target)); @@ -702,7 +703,7 @@ public class Aggregation { /** * Returns a new {@link AggregationOptions.Builder}. * - * @return + * @return new instance of {@link AggregationOptions.Builder}. * @since 1.6 */ public static AggregationOptions.Builder newAggregationOptions() { @@ -764,7 +765,7 @@ public class Aggregation { * otherwise. * * @param fieldRef may be {@literal null}. - * @return + * @return {@literal true} if the given field refers to a {@link SystemVariable}. */ public static boolean isReferingToSystemVariable(@Nullable String fieldRef) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationExpression.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationExpression.java index 5fb2e8278..7e15a7028 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationExpression.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationExpression.java @@ -31,8 +31,8 @@ public interface AggregationExpression { * Turns the {@link AggregationExpression} into a {@link Document} within the given * {@link AggregationOperationContext}. * - * @param context - * @return + * @param context must not be {@literal null}. + * @return the MongoDB native ({@link Document}) form of the expression. */ Document toDocument(AggregationOperationContext context); } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationExpressionTransformer.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationExpressionTransformer.java index a89905e66..635f00abe 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationExpressionTransformer.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationExpressionTransformer.java @@ -53,7 +53,7 @@ interface AggregationExpressionTransformer * @param currentNode must not be {@literal null}. * @param parentNode may be {@literal null}. * @param previousOperationObject may be {@literal null}. - * @param aggregationContext must not be {@literal null}. + * @param context must not be {@literal null}. */ public AggregationExpressionTransformationContext(T currentNode, @Nullable ExpressionNode parentNode, @Nullable Document previousOperationObject, AggregationOperationContext context) { @@ -67,7 +67,7 @@ interface AggregationExpressionTransformer /** * Returns the underlying {@link AggregationOperationContext}. * - * @return + * @return never {@literal null}. */ public AggregationOperationContext getAggregationContext() { return aggregationContext; @@ -76,7 +76,7 @@ interface AggregationExpressionTransformer /** * Returns the {@link FieldReference} for the current {@link ExpressionNode}. * - * @return + * @return never {@literal null}. */ public FieldReference getFieldReference() { return aggregationContext.getReference(getCurrentNode().getName()); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationFunctionExpressions.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationFunctionExpressions.java index 28e8b63f6..4c7f68766 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationFunctionExpressions.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationFunctionExpressions.java @@ -41,7 +41,7 @@ public enum AggregationFunctionExpressions { * Returns an {@link AggregationExpression} build from the current {@link Enum} name and the given parameters. * * @param parameters must not be {@literal null} - * @return + * @return new instance of {@link AggregationExpression}. */ public AggregationExpression of(Object... parameters) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationContext.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationContext.java index 6862cf515..b86407edb 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationContext.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOperationContext.java @@ -57,20 +57,20 @@ public interface AggregationOperationContext { Document getMappedObject(Document document, @Nullable Class type); /** - * Returns a {@link FieldReference} for the given field or {@literal null} if the context does not expose the given - * field. + * Returns a {@link FieldReference} for the given field. * * @param field must not be {@literal null}. - * @return + * @return the {@link FieldReference} for the given {@link Field}. + * @throws IllegalArgumentException if the context does not expose a field with the given name */ FieldReference getReference(Field field); /** - * Returns the {@link FieldReference} for the field with the given name or {@literal null} if the context does not - * expose a field with the given name. + * Returns the {@link FieldReference} for the field with the given name. * * @param name must not be {@literal null} or empty. - * @return + * @return the {@link FieldReference} for the field with given {@literal name}. + * @throws IllegalArgumentException if the context does not expose a field with the given name */ FieldReference getReference(String name); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOptions.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOptions.java index 5be87b573..96b199b8c 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOptions.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationOptions.java @@ -70,7 +70,7 @@ public class AggregationOptions { * @param allowDiskUse whether to off-load intensive sort-operations to disk. * @param explain whether to get the execution plan for the aggregation instead of the actual results. * @param cursor can be {@literal null}, used to pass additional options (such as {@code batchSize}) to the - * aggregation. + * aggregation. * @param collation collation for string comparison. Can be {@literal null}. * @since 2.0 */ @@ -85,7 +85,7 @@ public class AggregationOptions { * @param allowDiskUse whether to off-load intensive sort-operations to disk. * @param explain whether to get the execution plan for the aggregation instead of the actual results. * @param cursor can be {@literal null}, used to pass additional options (such as {@code batchSize}) to the - * aggregation. + * aggregation. * @param collation collation for string comparison. Can be {@literal null}. * @param comment execution comment. Can be {@literal null}. * @since 2.2 @@ -151,7 +151,7 @@ public class AggregationOptions { * Enables writing to temporary files. When set to true, aggregation stages can write data to the _tmp subdirectory in * the dbPath directory. * - * @return + * @return {@literal true} if enabled. */ public boolean isAllowDiskUse() { return allowDiskUse; @@ -160,7 +160,7 @@ public class AggregationOptions { /** * Specifies to return the information on the processing of the pipeline. * - * @return + * @return {@literal true} if enabled. */ public boolean isExplain() { return explain; @@ -185,7 +185,7 @@ public class AggregationOptions { /** * Specify a document that contains options that control the creation of the cursor object. * - * @return + * @return never {@literal null}. */ public Optional getCursor() { return cursor; @@ -194,7 +194,7 @@ public class AggregationOptions { /** * Get collation settings for string comparison. * - * @return + * @return never {@literal null}. * @since 2.0 */ public Optional getCollation() { @@ -204,7 +204,7 @@ public class AggregationOptions { /** * Get the comment for the aggregation. * - * @return + * @return never {@literal null}. * @since 2.2 */ public Optional getComment() { @@ -256,7 +256,7 @@ public class AggregationOptions { /** * Returns a {@link Document} representation of this {@link AggregationOptions}. * - * @return + * @return never {@literal null}. */ public Document toDocument() { @@ -276,7 +276,7 @@ public class AggregationOptions { } /** - * @return + * @return {@literal true} if {@link #maxTime} is set to a positive value. * @since 3.0 */ public boolean hasExecutionTimeLimit() { @@ -313,8 +313,8 @@ public class AggregationOptions { /** * Defines whether to off-load intensive sort-operations to disk. * - * @param allowDiskUse - * @return + * @param allowDiskUse use {@literal true} to allow disk use during the aggregation. + * @return this. */ public Builder allowDiskUse(boolean allowDiskUse) { @@ -325,8 +325,8 @@ public class AggregationOptions { /** * Defines whether to get the execution plan for the aggregation instead of the actual results. * - * @param explain - * @return + * @param explain use {@literal true} to enable explain feature. + * @return this. */ public Builder explain(boolean explain) { @@ -337,8 +337,8 @@ public class AggregationOptions { /** * Additional options to the aggregation. * - * @param cursor - * @return + * @param cursor must not be {@literal null}. + * @return this. */ public Builder cursor(Document cursor) { @@ -349,8 +349,8 @@ public class AggregationOptions { /** * Define the initial cursor batch size. * - * @param batchSize - * @return + * @param batchSize use a positive int. + * @return this. * @since 2.0 */ public Builder cursorBatchSize(int batchSize) { @@ -363,7 +363,7 @@ public class AggregationOptions { * Define collation settings for string comparison. * * @param collation can be {@literal null}. - * @return + * @return this. * @since 2.0 */ public Builder collation(@Nullable Collation collation) { @@ -376,7 +376,7 @@ public class AggregationOptions { * Define a comment to describe the execution. * * @param comment can be {@literal null}. - * @return + * @return this. * @since 2.2 */ public Builder comment(@Nullable String comment) { @@ -389,7 +389,7 @@ public class AggregationOptions { * Set the time limit for processing. * * @param maxTime {@link Duration#ZERO} is used for the default unbounded behavior. {@link Duration#isNegative() - * Negative} values will be ignored. + * Negative} values will be ignored. * @return this. * @since 3.0 */ @@ -402,7 +402,7 @@ public class AggregationOptions { /** * Returns a new {@link AggregationOptions} instance with the given configuration. * - * @return + * @return new instance of {@link AggregationOptions}. */ public AggregationOptions build() { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationResults.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationResults.java index 2e6cd7257..fd14b1a0b 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationResults.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationResults.java @@ -59,7 +59,7 @@ public class AggregationResults implements Iterable { /** * Returns the aggregation results. * - * @return + * @return the list of already mapped results or an empty one if none found. */ public List getMappedResults() { return mappedResults; @@ -68,7 +68,7 @@ public class AggregationResults implements Iterable { /** * Returns the unique mapped result. Assumes no result or exactly one. * - * @return + * @return the single already mapped result object or raise an error if more than one found. * @throws IllegalArgumentException in case more than one result is available. */ @Nullable @@ -88,7 +88,7 @@ public class AggregationResults implements Iterable { /** * Returns the server that has been used to perform the aggregation. * - * @return + * @return can be {@literal null}. */ @Nullable public String getServerUsed() { @@ -98,7 +98,7 @@ public class AggregationResults implements Iterable { /** * Returns the raw result that was returned by the server. * - * @return + * @return the raw response. * @since 1.6 */ public Document getRawResults() { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationSpELExpression.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationSpELExpression.java index 23bb50e36..0556410c8 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationSpELExpression.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationSpELExpression.java @@ -56,7 +56,7 @@ public class AggregationSpELExpression implements AggregationExpression { * * @param expressionString must not be {@literal null}. * @param parameters can be empty. - * @return + * @return new instance of {@link AggregationSpELExpression}. */ public static AggregationSpELExpression expressionOf(String expressionString, Object... parameters) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationUpdate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationUpdate.java index c97ca3974..e5dadc841 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationUpdate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationUpdate.java @@ -164,7 +164,7 @@ public class AggregationUpdate extends Aggregation implements UpdateDefinition { * {@code $replaceWith} replaces the input document with the specified document. The operation replaces all existing * fields in the input document, including the _id field. * - * @param replaceWithOperation + * @param replaceWithOperation must not be {@literal null}. * @return this. * @see $replaceWith Aggregation * Reference @@ -219,8 +219,8 @@ public class AggregationUpdate extends Aggregation implements UpdateDefinition { /** * Short for {@link #unset(UnsetOperation)}. * - * @param keys - * @return + * @param keys the fields to remove. + * @return this. */ public AggregationUpdate unset(String... keys) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationUtils.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationUtils.java index ae5b959fb..d729b9dfa 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationUtils.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/AggregationUtils.java @@ -32,9 +32,9 @@ interface AggregationUtils { * Converts the given {@link Range} into an array of values. * * @param range must not be {@literal null}. - * @return + * @return never {@literal null}. */ - public static List toRangeValues(Range range) { + static List toRangeValues(Range range) { Assert.notNull(range, "Range must not be null!"); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArithmeticOperators.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArithmeticOperators.java index 9cda3ffcd..2fbc64304 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArithmeticOperators.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArithmeticOperators.java @@ -38,7 +38,7 @@ public class ArithmeticOperators { * Take the field referenced by given {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link ArithmeticOperatorFactory}. */ public static ArithmeticOperatorFactory valueOf(String fieldReference) { return new ArithmeticOperatorFactory(fieldReference); @@ -48,7 +48,7 @@ public class ArithmeticOperators { * Take the value resulting from the given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link ArithmeticOperatorFactory}. */ public static ArithmeticOperatorFactory valueOf(AggregationExpression expression) { return new ArithmeticOperatorFactory(expression); @@ -89,7 +89,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that returns the absolute value of the associated number. * - * @return + * @return new instance of {@link Abs}. */ public Abs abs() { return usesFieldRef() ? Abs.absoluteValueOf(fieldReference) : Abs.absoluteValueOf(expression); @@ -100,7 +100,7 @@ public class ArithmeticOperators { * number. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Add}. */ public Add add(String fieldReference) { @@ -113,7 +113,7 @@ public class ArithmeticOperators { * {@link AggregationExpression} to the associated number. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Add}. */ public Add add(AggregationExpression expression) { @@ -125,7 +125,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that adds the given {@literal value} to the associated number. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Add}. */ public Add add(Number value) { @@ -141,7 +141,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that returns the smallest integer greater than or equal to the * assoicated number. * - * @return + * @return new instance of {@link Ceil}. */ public Ceil ceil() { return usesFieldRef() ? Ceil.ceilValueOf(fieldReference) : Ceil.ceilValueOf(expression); @@ -152,7 +152,7 @@ public class ArithmeticOperators { * {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Divide}. */ public Divide divideBy(String fieldReference) { @@ -165,7 +165,7 @@ public class ArithmeticOperators { * {@literal expression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Divide}. */ public Divide divideBy(AggregationExpression expression) { @@ -176,8 +176,8 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that divides the associated number by given {@literal value}. * - * @param value - * @return + * @param value must not be {@literal null}. + * @return new instance of {@link Divide}. */ public Divide divideBy(Number value) { @@ -192,7 +192,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that raises Euler’s number (i.e. e ) on the associated number. * - * @return + * @return new instance of {@link Exp}. */ public Exp exp() { return usesFieldRef() ? Exp.expValueOf(fieldReference) : Exp.expValueOf(expression); @@ -202,7 +202,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that returns the largest integer less than or equal to the associated * number. * - * @return + * @return new instance of {@link Floor}. */ public Floor floor() { return usesFieldRef() ? Floor.floorValueOf(fieldReference) : Floor.floorValueOf(expression); @@ -212,7 +212,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that calculates the natural logarithm ln (i.e loge) of the assoicated * number. * - * @return + * @return new instance of {@link Ln}. */ public Ln ln() { return usesFieldRef() ? Ln.lnValueOf(fieldReference) : Ln.lnValueOf(expression); @@ -223,7 +223,7 @@ public class ArithmeticOperators { * referenced via {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Log}. */ public Log log(String fieldReference) { @@ -236,7 +236,7 @@ public class ArithmeticOperators { * extracted by given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Log}. */ public Log log(AggregationExpression expression) { @@ -249,7 +249,7 @@ public class ArithmeticOperators { * {@literal base}. * * @param base must not be {@literal null}. - * @return + * @return new instance of {@link Log}. */ public Log log(Number base) { @@ -264,7 +264,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that calculates the log base 10 for the associated number. * - * @return + * @return new instance of {@link Log10}. */ public Log10 log10() { return usesFieldRef() ? Log10.log10ValueOf(fieldReference) : Log10.log10ValueOf(expression); @@ -275,7 +275,7 @@ public class ArithmeticOperators { * remainder. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Mod}. */ public Mod mod(String fieldReference) { @@ -288,7 +288,7 @@ public class ArithmeticOperators { * remainder. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Mod}. */ public Mod mod(AggregationExpression expression) { @@ -301,7 +301,7 @@ public class ArithmeticOperators { * remainder. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Mod}. */ public Mod mod(Number value) { @@ -317,7 +317,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that multiplies the associated number with another. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Multiply}. */ public Multiply multiplyBy(String fieldReference) { @@ -329,7 +329,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that multiplies the associated number with another. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Multiply}. */ public Multiply multiplyBy(AggregationExpression expression) { @@ -341,7 +341,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that multiplies the associated number with another. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Multiply}. */ public Multiply multiplyBy(Number value) { @@ -357,7 +357,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that raises the associated number to the specified exponent. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Pow}. */ public Pow pow(String fieldReference) { @@ -369,7 +369,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that raises the associated number to the specified exponent. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Pow}. */ public Pow pow(AggregationExpression expression) { @@ -381,7 +381,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that raises the associated number to the specified exponent. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Pow}. */ public Pow pow(Number value) { @@ -396,7 +396,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that calculates the square root of the associated number. * - * @return + * @return new instance of {@link Sqrt}. */ public Sqrt sqrt() { return usesFieldRef() ? Sqrt.sqrtOf(fieldReference) : Sqrt.sqrtOf(expression); @@ -406,7 +406,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that subtracts value of given from the associated number. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Subtract}. */ public Subtract subtract(String fieldReference) { @@ -418,7 +418,7 @@ public class ArithmeticOperators { * Creates new {@link AggregationExpression} that subtracts value of given from the associated number. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Subtract}. */ public Subtract subtract(AggregationExpression expression) { @@ -429,8 +429,8 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that subtracts value from the associated number. * - * @param value - * @return + * @param value must not be {@literal null}. + * @return new instance of {@link Subtract}. */ public Subtract subtract(Number value) { @@ -445,7 +445,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that truncates a number to its integer. * - * @return + * @return new instance of {@link Trunc}. */ public Trunc trunc() { return usesFieldRef() ? Trunc.truncValueOf(fieldReference) : Trunc.truncValueOf(expression); @@ -454,7 +454,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that calculates and returns the sum of numeric values. * - * @return + * @return new instance of {@link Sum}. */ public Sum sum() { return usesFieldRef() ? AccumulatorOperators.Sum.sumOf(fieldReference) @@ -464,7 +464,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that returns the average value of the numeric values. * - * @return + * @return new instance of {@link Avg}. */ public Avg avg() { return usesFieldRef() ? AccumulatorOperators.Avg.avgOf(fieldReference) @@ -474,7 +474,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that returns the maximum value. * - * @return + * @return new instance of {@link Max}. */ public Max max() { return usesFieldRef() ? AccumulatorOperators.Max.maxOf(fieldReference) @@ -484,7 +484,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that returns the minimum value. * - * @return + * @return new instance of {@link Min}. */ public Min min() { return usesFieldRef() ? AccumulatorOperators.Min.minOf(fieldReference) @@ -494,7 +494,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that calculates the population standard deviation of the input values. * - * @return + * @return new instance of {@link StdDevPop}. */ public StdDevPop stdDevPop() { return usesFieldRef() ? AccumulatorOperators.StdDevPop.stdDevPopOf(fieldReference) @@ -504,7 +504,7 @@ public class ArithmeticOperators { /** * Creates new {@link AggregationExpression} that calculates the sample standard deviation of the input values. * - * @return + * @return new instance of {@link StdDevSamp}. */ public StdDevSamp stdDevSamp() { return usesFieldRef() ? AccumulatorOperators.StdDevSamp.stdDevSampOf(fieldReference) @@ -557,7 +557,7 @@ public class ArithmeticOperators { * Creates new {@link Abs}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Abs}. */ public static Abs absoluteValueOf(String fieldReference) { @@ -569,7 +569,7 @@ public class ArithmeticOperators { * Creates new {@link Abs}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Abs}. */ public static Abs absoluteValueOf(AggregationExpression expression) { @@ -581,7 +581,7 @@ public class ArithmeticOperators { * Creates new {@link Abs}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Abs}. */ public static Abs absoluteValueOf(Number value) { @@ -610,7 +610,7 @@ public class ArithmeticOperators { * Creates new {@link Add}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Add}. */ public static Add valueOf(String fieldReference) { @@ -622,7 +622,7 @@ public class ArithmeticOperators { * Creates new {@link Add}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Add}. */ public static Add valueOf(AggregationExpression expression) { @@ -634,7 +634,7 @@ public class ArithmeticOperators { * Creates new {@link Add}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Add}. */ public static Add valueOf(Number value) { @@ -642,18 +642,36 @@ public class ArithmeticOperators { return new Add(Collections.singletonList(value)); } + /** + * Add the value stored at the given field. + * + * @param fieldReference must not be {@literal null}. + * @return new instance of {@link Add}. + */ public Add add(String fieldReference) { Assert.notNull(fieldReference, "FieldReference must not be null!"); return new Add(append(Fields.field(fieldReference))); } + /** + * Add the evaluation result of the given {@link AggregationExpression}. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link Add}. + */ public Add add(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); return new Add(append(expression)); } + /** + * Add the given value. + * + * @param value must not be {@literal null}. + * @return new instance of {@link Add}. + */ public Add add(Number value) { return new Add(append(value)); } @@ -679,7 +697,7 @@ public class ArithmeticOperators { * Creates new {@link Ceil}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Ceil}. */ public static Ceil ceilValueOf(String fieldReference) { @@ -691,7 +709,7 @@ public class ArithmeticOperators { * Creates new {@link Ceil}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Ceil}. */ public static Ceil ceilValueOf(AggregationExpression expression) { @@ -703,7 +721,7 @@ public class ArithmeticOperators { * Creates new {@link Ceil}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Ceil}. */ public static Ceil ceilValueOf(Number value) { @@ -732,7 +750,7 @@ public class ArithmeticOperators { * Creates new {@link Divide}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Divide}. */ public static Divide valueOf(String fieldReference) { @@ -744,7 +762,7 @@ public class ArithmeticOperators { * Creates new {@link Divide}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Divide}. */ public static Divide valueOf(AggregationExpression expression) { @@ -756,7 +774,7 @@ public class ArithmeticOperators { * Creates new {@link Divide}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Divide}. */ public static Divide valueOf(Number value) { @@ -764,18 +782,36 @@ public class ArithmeticOperators { return new Divide(Collections.singletonList(value)); } + /** + * Divide by the value stored at the given field. + * + * @param fieldReference must not be {@literal null}. + * @return new instance of {@link Divide}. + */ public Divide divideBy(String fieldReference) { Assert.notNull(fieldReference, "FieldReference must not be null!"); return new Divide(append(Fields.field(fieldReference))); } + /** + * Divide by the evaluation results of the given {@link AggregationExpression}. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link Divide}. + */ public Divide divideBy(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); return new Divide(append(expression)); } + /** + * Divide by the given value. + * + * @param value must not be {@literal null}. + * @return new instance of {@link Divide}. + */ public Divide divideBy(Number value) { return new Divide(append(value)); } @@ -801,7 +837,7 @@ public class ArithmeticOperators { * Creates new {@link Exp}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Exp}. */ public static Exp expValueOf(String fieldReference) { @@ -813,7 +849,7 @@ public class ArithmeticOperators { * Creates new {@link Exp}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Exp}. */ public static Exp expValueOf(AggregationExpression expression) { @@ -825,7 +861,7 @@ public class ArithmeticOperators { * Creates new {@link Exp}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Exp}. */ public static Exp expValueOf(Number value) { @@ -854,7 +890,7 @@ public class ArithmeticOperators { * Creates new {@link Floor}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Floor}. */ public static Floor floorValueOf(String fieldReference) { @@ -866,7 +902,7 @@ public class ArithmeticOperators { * Creates new {@link Floor}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Floor}. */ public static Floor floorValueOf(AggregationExpression expression) { @@ -878,7 +914,7 @@ public class ArithmeticOperators { * Creates new {@link Floor}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Floor}. */ public static Floor floorValueOf(Number value) { @@ -907,7 +943,7 @@ public class ArithmeticOperators { * Creates new {@link Ln}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Ln}. */ public static Ln lnValueOf(String fieldReference) { @@ -919,7 +955,7 @@ public class ArithmeticOperators { * Creates new {@link Ln}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Ln}. */ public static Ln lnValueOf(AggregationExpression expression) { @@ -931,7 +967,7 @@ public class ArithmeticOperators { * Creates new {@link Ln}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Ln}. */ public static Ln lnValueOf(Number value) { @@ -960,7 +996,7 @@ public class ArithmeticOperators { * Creates new {@link Min}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Log}. */ public static Log valueOf(String fieldReference) { @@ -972,7 +1008,7 @@ public class ArithmeticOperators { * Creates new {@link Log}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Log}. */ public static Log valueOf(AggregationExpression expression) { @@ -992,18 +1028,36 @@ public class ArithmeticOperators { return new Log(Collections.singletonList(value)); } + /** + * Use the value stored at the given field as log base. + * + * @param fieldReference must not be {@literal null}. + * @return new instance of {@link Log}. + */ public Log log(String fieldReference) { Assert.notNull(fieldReference, "FieldReference must not be null!"); return new Log(append(Fields.field(fieldReference))); } + /** + * Use the evaluated value of the given {@link AggregationExpression} as log base. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link Log}. + */ public Log log(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); return new Log(append(expression)); } + /** + * Use the given value as log base. + * + * @param base must not be {@literal null}. + * @return new instance of {@link Log}. + */ public Log log(Number base) { return new Log(append(base)); } @@ -1029,7 +1083,7 @@ public class ArithmeticOperators { * Creates new {@link Log10}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Log10}. */ public static Log10 log10ValueOf(String fieldReference) { @@ -1041,7 +1095,7 @@ public class ArithmeticOperators { * Creates new {@link Log10}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Log10}. */ public static Log10 log10ValueOf(AggregationExpression expression) { @@ -1053,7 +1107,7 @@ public class ArithmeticOperators { * Creates new {@link Log10}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Log10}. */ public static Log10 log10ValueOf(Number value) { @@ -1082,7 +1136,7 @@ public class ArithmeticOperators { * Creates new {@link Mod}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Mod}. */ public static Mod valueOf(String fieldReference) { @@ -1094,7 +1148,7 @@ public class ArithmeticOperators { * Creates new {@link Mod}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Mod}. */ public static Mod valueOf(AggregationExpression expression) { @@ -1106,7 +1160,7 @@ public class ArithmeticOperators { * Creates new {@link Mod}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Mod}. */ public static Mod valueOf(Number value) { @@ -1114,18 +1168,36 @@ public class ArithmeticOperators { return new Mod(Collections.singletonList(value)); } + /** + * Use the value stored at the given field as mod base. + * + * @param fieldReference must not be {@literal null}. + * @return new instance of {@link Mod}. + */ public Mod mod(String fieldReference) { Assert.notNull(fieldReference, "FieldReference must not be null!"); return new Mod(append(Fields.field(fieldReference))); } + /** + * Use evaluated value of the given {@link AggregationExpression} as mod base. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link Mod}. + */ public Mod mod(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); return new Mod(append(expression)); } + /** + * Use the given value as mod base. + * + * @param base must not be {@literal null}. + * @return new instance of {@link Mod}. + */ public Mod mod(Number base) { return new Mod(append(base)); } @@ -1151,7 +1223,7 @@ public class ArithmeticOperators { * Creates new {@link Multiply}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Multiply}. */ public static Multiply valueOf(String fieldReference) { @@ -1163,7 +1235,7 @@ public class ArithmeticOperators { * Creates new {@link Multiply}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Multiply}. */ public static Multiply valueOf(AggregationExpression expression) { @@ -1175,7 +1247,7 @@ public class ArithmeticOperators { * Creates new {@link Multiply}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Multiply}. */ public static Multiply valueOf(Number value) { @@ -1183,18 +1255,36 @@ public class ArithmeticOperators { return new Multiply(Collections.singletonList(value)); } + /** + * Multiply by the value stored at the given field. + * + * @param fieldReference must not be {@literal null}. + * @return new instance of {@link Multiply}. + */ public Multiply multiplyBy(String fieldReference) { Assert.notNull(fieldReference, "FieldReference must not be null!"); return new Multiply(append(Fields.field(fieldReference))); } + /** + * Multiply by the evaluated value of the given {@link AggregationExpression}. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link Multiply}. + */ public Multiply multiplyBy(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); return new Multiply(append(expression)); } + /** + * Multiply by the given value. + * + * @param value must not be {@literal null}. + * @return new instance of {@link Multiply}. + */ public Multiply multiplyBy(Number value) { return new Multiply(append(value)); } @@ -1252,18 +1342,36 @@ public class ArithmeticOperators { return new Pow(Collections.singletonList(value)); } + /** + * Pow by the value stored at the given field. + * + * @param fieldReference must not be {@literal null}. + * @return new instance of {@link Pow}. + */ public Pow pow(String fieldReference) { Assert.notNull(fieldReference, "FieldReference must not be null!"); return new Pow(append(Fields.field(fieldReference))); } + /** + * Pow by the evaluated value of the given {@link AggregationExpression}. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link Pow}. + */ public Pow pow(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); return new Pow(append(expression)); } + /** + * Pow by the given value. + * + * @param value must not be {@literal null}. + * @return new instance of {@link Pow}. + */ public Pow pow(Number value) { return new Pow(append(value)); } @@ -1289,7 +1397,7 @@ public class ArithmeticOperators { * Creates new {@link Sqrt}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Sqrt}. */ public static Sqrt sqrtOf(String fieldReference) { @@ -1301,7 +1409,7 @@ public class ArithmeticOperators { * Creates new {@link Sqrt}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Sqrt}. */ public static Sqrt sqrtOf(AggregationExpression expression) { @@ -1313,7 +1421,7 @@ public class ArithmeticOperators { * Creates new {@link Sqrt}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Sqrt}. */ public static Sqrt sqrtOf(Number value) { @@ -1342,7 +1450,7 @@ public class ArithmeticOperators { * Creates new {@link Subtract}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Subtract}. */ public static Subtract valueOf(String fieldReference) { @@ -1354,7 +1462,7 @@ public class ArithmeticOperators { * Creates new {@link Subtract}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Subtract}. */ public static Subtract valueOf(AggregationExpression expression) { @@ -1366,7 +1474,7 @@ public class ArithmeticOperators { * Creates new {@link Subtract}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Subtract}. */ public static Subtract valueOf(Number value) { @@ -1374,18 +1482,36 @@ public class ArithmeticOperators { return new Subtract(Collections.singletonList(value)); } + /** + * Subtract the value stored at the given field. + * + * @param fieldReference must not be {@literal null}. + * @return new instance of {@link Pow}. + */ public Subtract subtract(String fieldReference) { Assert.notNull(fieldReference, "FieldReference must not be null!"); return new Subtract(append(Fields.field(fieldReference))); } + /** + * Subtract the evaluated value of the given {@link AggregationExpression}. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link Pow}. + */ public Subtract subtract(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); return new Subtract(append(expression)); } + /** + * Subtract the given value. + * + * @param value must not be {@literal null}. + * @return new instance of {@link Pow}. + */ public Subtract subtract(Number value) { return new Subtract(append(value)); } @@ -1411,7 +1537,7 @@ public class ArithmeticOperators { * Creates new {@link Trunc}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Trunc}. */ public static Trunc truncValueOf(String fieldReference) { @@ -1423,7 +1549,7 @@ public class ArithmeticOperators { * Creates new {@link Trunc}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Trunc}. */ public static Trunc truncValueOf(AggregationExpression expression) { @@ -1435,7 +1561,7 @@ public class ArithmeticOperators { * Creates new {@link Trunc}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Trunc}. */ public static Trunc truncValueOf(Number value) { @@ -1502,7 +1628,7 @@ public class ArithmeticOperators { /** * The place to round to. Can be between -20 and 100, exclusive. * - * @param place + * @param place value between -20 and 100, exclusive. * @return new instance of {@link Round}. */ public Round place(int place) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArrayOperators.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArrayOperators.java index ee1b3806b..5a982c06f 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArrayOperators.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ArrayOperators.java @@ -43,7 +43,7 @@ public class ArrayOperators { * Take the array referenced by given {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link ArrayOperatorFactory}. */ public static ArrayOperatorFactory arrayOf(String fieldReference) { return new ArrayOperatorFactory(fieldReference); @@ -53,7 +53,7 @@ public class ArrayOperators { * Take the array referenced resulting from the given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link ArrayOperatorFactory}. */ public static ArrayOperatorFactory arrayOf(AggregationExpression expression) { return new ArrayOperatorFactory(expression); @@ -123,8 +123,8 @@ public class ArrayOperators { * Creates new {@link AggregationExpression} that takes the associated array and returns the element at the * specified array {@literal position}. * - * @param position - * @return + * @param position the element index. + * @return new instance of {@link ArrayElemAt}. */ public ArrayElemAt elementAt(int position) { return createArrayElemAt().elementAt(position); @@ -135,7 +135,7 @@ public class ArrayOperators { * resulting form the given {@literal expression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link ArrayElemAt}. */ public ArrayElemAt elementAt(AggregationExpression expression) { @@ -148,7 +148,7 @@ public class ArrayOperators { * defined by the referenced {@literal field}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link ArrayElemAt}. */ public ArrayElemAt elementAt(String fieldReference) { @@ -170,7 +170,7 @@ public class ArrayOperators { * {@literal arrayFieldReference} to it. * * @param arrayFieldReference must not be {@literal null}. - * @return + * @return new instance of {@link ConcatArrays}. */ public ConcatArrays concat(String arrayFieldReference) { @@ -183,7 +183,7 @@ public class ArrayOperators { * the given {@literal expression} to it. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link ConcatArrays}. */ public ConcatArrays concat(AggregationExpression expression) { @@ -204,7 +204,7 @@ public class ArrayOperators { * Creates new {@link AggregationExpression} that takes the associated array and selects a subset of the array to * return based on the specified condition. * - * @return + * @return new instance of {@link AsBuilder} to create a {@link Filter}. */ public AsBuilder filter() { @@ -219,7 +219,7 @@ public class ArrayOperators { /** * Creates new {@link AggregationExpression} that takes the associated array and an check if its an array. * - * @return + * @return new instance of {@link IsArray}. */ public IsArray isArray() { @@ -231,7 +231,7 @@ public class ArrayOperators { /** * Creates new {@link AggregationExpression} that takes the associated array and retrieves its length. * - * @return + * @return new instance of {@link Size}. */ public Size length() { @@ -245,7 +245,7 @@ public class ArrayOperators { /** * Creates new {@link AggregationExpression} that takes the associated array and selects a subset from it. * - * @return + * @return new instance of {@link Slice}. */ public Slice slice() { @@ -261,7 +261,7 @@ public class ArrayOperators { * value and returns the array index (zero-based) of the first occurrence. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfArray}. */ public IndexOfArray indexOf(Object value) { @@ -276,7 +276,7 @@ public class ArrayOperators { /** * Creates new {@link AggregationExpression} that returns an array with the elements in reverse order. * - * @return + * @return new instance of {@link ReverseArray}. */ public ReverseArray reverse() { @@ -293,7 +293,7 @@ public class ArrayOperators { * an array and combines them into a single value. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link ReduceInitialValueBuilder} to create {@link Reduce}. */ public ArrayOperatorFactory.ReduceInitialValueBuilder reduce(AggregationExpression expression) { @@ -305,8 +305,8 @@ public class ArrayOperators { * Start creating new {@link AggregationExpression} that applies an {@link AggregationExpression} to each element in * an array and combines them into a single value. * - * @param expressions - * @return + * @param expressions must not be {@literal null}. + * @return new instance of {@link ReduceInitialValueBuilder} to create {@link Reduce}. */ public ArrayOperatorFactory.ReduceInitialValueBuilder reduce(PropertyExpression... expressions) { @@ -320,7 +320,7 @@ public class ArrayOperators { * the second input array, etc. * * @param arrays must not be {@literal null}. - * @return + * @return new instance of {@link Zip}. */ public Zip zipWith(Object... arrays) { @@ -336,7 +336,7 @@ public class ArrayOperators { * associated array. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link In}. */ public In containsValue(Object value) { @@ -413,7 +413,7 @@ public class ArrayOperators { * Creates new {@link ArrayElemAt}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link ArrayElemAt}. */ public static ArrayElemAt arrayOf(String fieldReference) { @@ -425,7 +425,7 @@ public class ArrayOperators { * Creates new {@link ArrayElemAt}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link ArrayElemAt}. */ public static ArrayElemAt arrayOf(AggregationExpression expression) { @@ -446,16 +446,34 @@ public class ArrayOperators { return new ArrayElemAt(Collections.singletonList(values)); } + /** + * Use the element with given index number. + * + * @param index the index number + * @return new instance of {@link ArrayElemAt}. + */ public ArrayElemAt elementAt(int index) { return new ArrayElemAt(append(index)); } + /** + * Use the element at the index number evaluated from the given {@link AggregationExpression}. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link ArrayElemAt}. + */ public ArrayElemAt elementAt(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); return new ArrayElemAt(append(expression)); } + /** + * Use the element at the index number traken from the given field. + * + * @param arrayFieldReference the field name. + * @return new instance of {@link ArrayElemAt}. + */ public ArrayElemAt elementAt(String arrayFieldReference) { Assert.notNull(arrayFieldReference, "ArrayReference must not be null!"); @@ -483,7 +501,7 @@ public class ArrayOperators { * Creates new {@link ConcatArrays}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link ConcatArrays}. */ public static ConcatArrays arrayOf(String fieldReference) { @@ -495,7 +513,7 @@ public class ArrayOperators { * Creates new {@link ConcatArrays}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link ConcatArrays}. */ public static ConcatArrays arrayOf(AggregationExpression expression) { @@ -516,12 +534,24 @@ public class ArrayOperators { return new ConcatArrays(Collections.singletonList(values)); } + /** + * Concat with the array stored at the given field. + * + * @param arrayFieldReference must not be {@literal null}. + * @return new instance of {@link ConcatArrays}. + */ public ConcatArrays concat(String arrayFieldReference) { Assert.notNull(arrayFieldReference, "ArrayFieldReference must not be null!"); return new ConcatArrays(append(Fields.field(arrayFieldReference))); } + /** + * Concat with the array resulting from the given {@link AggregationExpression}. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link ConcatArrays}. + */ public ConcatArrays concat(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); @@ -574,7 +604,7 @@ public class ArrayOperators { * Set the {@literal values} to apply the {@code $filter} to. * * @param values must not be {@literal null}. - * @return + * @return new instance of {@link AsBuilder} to create the {@link Filter}. */ public static AsBuilder filter(List values) { @@ -651,7 +681,7 @@ public class ArrayOperators { * Set the {@literal variableName} for the elements in the input array. * * @param variableName must not be {@literal null}. - * @return + * @return never {@literal null}. */ ConditionBuilder as(String variableName); } @@ -665,7 +695,7 @@ public class ArrayOperators { * Set the {@link AggregationExpression} that determines whether to include the element in the resulting array. * * @param expression must not be {@literal null}. - * @return + * @return never {@literal null}. */ Filter by(AggregationExpression expression); @@ -673,7 +703,7 @@ public class ArrayOperators { * Set the {@literal expression} that determines whether to include the element in the resulting array. * * @param expression must not be {@literal null}. - * @return + * @return never {@literal null}. */ Filter by(String expression); @@ -681,7 +711,7 @@ public class ArrayOperators { * Set the {@literal expression} that determines whether to include the element in the resulting array. * * @param expression must not be {@literal null}. - * @return + * @return never {@literal null}. */ Filter by(Document expression); } @@ -700,7 +730,7 @@ public class ArrayOperators { /** * Creates new {@link InputBuilder}. * - * @return + * @return new instance of {@link FilterExpressionBuilder}. */ public static InputBuilder newBuilder() { return new FilterExpressionBuilder(); @@ -800,7 +830,7 @@ public class ArrayOperators { * Creates new {@link IsArray}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link IsArray}. */ public static IsArray isArray(String fieldReference) { @@ -812,7 +842,7 @@ public class ArrayOperators { * Creates new {@link IsArray}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IsArray}. */ public static IsArray isArray(AggregationExpression expression) { @@ -841,7 +871,7 @@ public class ArrayOperators { * Creates new {@link Size}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Size}. */ public static Size lengthOfArray(String fieldReference) { @@ -853,7 +883,7 @@ public class ArrayOperators { * Creates new {@link Size}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Size}. */ public static Size lengthOfArray(AggregationExpression expression) { @@ -895,7 +925,7 @@ public class ArrayOperators { * Creates new {@link Slice}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Slice}. */ public static Slice sliceArrayOf(String fieldReference) { @@ -907,7 +937,7 @@ public class ArrayOperators { * Creates new {@link Slice}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Slice}. */ public static Slice sliceArrayOf(AggregationExpression expression) { @@ -928,10 +958,22 @@ public class ArrayOperators { return new Slice(Collections.singletonList(values)); } + /** + * Slice the number of elements. + * + * @param nrElements elements to slice. + * @return new instance of {@link Slice}. + */ public Slice itemCount(int nrElements) { return new Slice(append(nrElements)); } + /** + * Slice using offset and count. + * + * @param position the start position + * @return new instance of {@link SliceElementsBuilder} to create {@link Slice}. + */ public SliceElementsBuilder offset(final int position) { return new SliceElementsBuilder() { @@ -978,7 +1020,7 @@ public class ArrayOperators { * Start creating new {@link IndexOfArray}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfArray}. */ public static IndexOfArrayBuilder arrayOf(String fieldReference) { @@ -990,7 +1032,7 @@ public class ArrayOperators { * Start creating new {@link IndexOfArray}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfArray}. */ public static IndexOfArrayBuilder arrayOf(AggregationExpression expression) { @@ -1002,7 +1044,7 @@ public class ArrayOperators { * Start creating new {@link IndexOfArray}. * * @param values must not be {@literal null}. - * @return new instance of {@link IndexOfArray}. + * @return new instance of {@link IndexOfArrayBuilder} to create {@link IndexOfArray}. * @since 2.2 */ public static IndexOfArrayBuilder arrayOf(Collection values) { @@ -1011,6 +1053,12 @@ public class ArrayOperators { return new IndexOfArrayBuilder(values); } + /** + * Lookup within a given range. + * + * @param range the lookup range. + * @return new instance of {@link IndexOfArray}. + */ public IndexOfArray within(Range range) { return new IndexOfArray(append(AggregationUtils.toRangeValues(range))); } @@ -1030,7 +1078,7 @@ public class ArrayOperators { * Set the {@literal value} to check for its index in the array. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfArray}. */ public IndexOfArray indexOf(Object value) { @@ -1060,7 +1108,7 @@ public class ArrayOperators { * Start creating new {@link RangeOperator}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link RangeOperatorBuilder} to create {@link RangeOperator}. */ public static RangeOperatorBuilder rangeStartingAt(String fieldReference) { return new RangeOperatorBuilder(Fields.field(fieldReference)); @@ -1070,7 +1118,7 @@ public class ArrayOperators { * Start creating new {@link RangeOperator}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link RangeOperatorBuilder} to create {@link RangeOperator}. */ public static RangeOperatorBuilder rangeStartingAt(AggregationExpression expression) { return new RangeOperatorBuilder(expression); @@ -1080,7 +1128,7 @@ public class ArrayOperators { * Start creating new {@link RangeOperator}. * * @param value - * @return + * @return new instance of {@link RangeOperator}. */ public static RangeOperatorBuilder rangeStartingAt(long value) { return new RangeOperatorBuilder(value); @@ -1102,7 +1150,7 @@ public class ArrayOperators { * Creates new {@link RangeOperator}. * * @param index - * @return + * @return new instance of {@link RangeOperator}. */ public RangeOperator to(long index) { return new RangeOperator(Arrays.asList(startPoint, index)); @@ -1112,7 +1160,7 @@ public class ArrayOperators { * Creates new {@link RangeOperator}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link RangeOperator}. */ public RangeOperator to(AggregationExpression expression) { return new RangeOperator(Arrays.asList(startPoint, expression)); @@ -1122,7 +1170,7 @@ public class ArrayOperators { * Creates new {@link RangeOperator}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link RangeOperator}. */ public RangeOperator to(String fieldReference) { return new RangeOperator(Arrays.asList(startPoint, Fields.field(fieldReference))); @@ -1150,7 +1198,7 @@ public class ArrayOperators { * Creates new {@link ReverseArray} given {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link ReverseArray}. */ public static ReverseArray reverseArrayOf(String fieldReference) { return new ReverseArray(Fields.field(fieldReference)); @@ -1160,7 +1208,7 @@ public class ArrayOperators { * Creates new {@link ReverseArray} given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link ReverseArray}. */ public static ReverseArray reverseArrayOf(AggregationExpression expression) { return new ReverseArray(expression); @@ -1239,7 +1287,7 @@ public class ArrayOperators { * Start creating new {@link Reduce}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link InitialValueBuilder} to create {@link Reduce}. */ public static InitialValueBuilder arrayOf(final String fieldReference) { @@ -1267,7 +1315,7 @@ public class ArrayOperators { Assert.notNull(expressions, "PropertyExpressions must not be null"); return new Reduce(Fields.field(fieldReference), initialValue, - Arrays. asList(expressions)); + Arrays.asList(expressions)); } }; } @@ -1278,7 +1326,7 @@ public class ArrayOperators { * Start creating new {@link Reduce}. * * @param arrayValueExpression must not be {@literal null}. - * @return + * @return new instance of {@link InitialValueBuilder} to create {@link Reduce}. */ public static InitialValueBuilder arrayOf(final AggregationExpression arrayValueExpression) { @@ -1318,7 +1366,7 @@ public class ArrayOperators { * Define the initial cumulative value set before in is applied to the first element of the input array. * * @param initialValue must not be {@literal null}. - * @return + * @return never {@literal null}. */ ReduceBuilder withInitialValue(Object initialValue); } @@ -1335,7 +1383,7 @@ public class ArrayOperators { * {@link Variable#VALUE} are available. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Reduce}. */ Reduce reduce(AggregationExpression expression); @@ -1346,7 +1394,7 @@ public class ArrayOperators { * {@link Variable#VALUE} are available. * * @param expressions must not be {@literal null}. - * @return + * @return new instance of {@link Reduce}. */ Reduce reduce(PropertyExpression... expressions); } @@ -1372,7 +1420,7 @@ public class ArrayOperators { * Define a result property for an {@link AggregationExpression} used in {@link Reduce}. * * @param name must not be {@literal null}. - * @return + * @return new instance of {@link AsBuilder} to create {@link Reduce}. */ public static AsBuilder property(final String name) { @@ -1402,7 +1450,7 @@ public class ArrayOperators { * Set the {@link AggregationExpression} resulting in the properties value. * * @param expression must not be {@literal null}. - * @return + * @return never {@literal null}. */ PropertyExpression definedAs(AggregationExpression expression); } @@ -1459,7 +1507,7 @@ public class ArrayOperators { * eg. {@code $$value.product} * * @param property must not be {@literal null}. - * @return + * @return never {@literal null}. */ public Field referringTo(final String property) { @@ -1508,7 +1556,7 @@ public class ArrayOperators { * Start creating new {@link Zip}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link ZipBuilder} to create {@link Zip}. */ public static ZipBuilder arrayOf(String fieldReference) { @@ -1520,7 +1568,7 @@ public class ArrayOperators { * Start creating new {@link Zip}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link ZipBuilder} to create {@link Zip}. */ public static ZipBuilder arrayOf(AggregationExpression expression) { @@ -1544,7 +1592,7 @@ public class ArrayOperators { /** * Create new {@link Zip} and set the {@code useLongestLength} property to {@literal true}. * - * @return + * @return new instance of {@link Zip}. */ public Zip useLongestLength() { return new Zip(append("useLongestLength", true)); @@ -1554,7 +1602,7 @@ public class ArrayOperators { * Optionally provide a default value. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Zip}. */ public Zip defaultTo(String fieldReference) { @@ -1566,7 +1614,7 @@ public class ArrayOperators { * Optionally provide a default value. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Zip}. */ public Zip defaultTo(AggregationExpression expression) { @@ -1578,7 +1626,7 @@ public class ArrayOperators { * Optionally provide a default value. * * @param array must not be {@literal null}. - * @return + * @return new instance of {@link Zip}. */ public Zip defaultTo(Object[] array) { @@ -1602,7 +1650,7 @@ public class ArrayOperators { * array, etc. * * @param arrays arrays to zip the referenced one with. must not be {@literal null}. - * @return + * @return new instance of {@link Zip}. */ public Zip zip(Object... arrays) { @@ -1616,7 +1664,7 @@ public class ArrayOperators { } } - return new Zip(Collections. singletonMap("inputs", sourceArrays)); + return new Zip(Collections.singletonMap("inputs", sourceArrays)); } } } @@ -1627,7 +1675,7 @@ public class ArrayOperators { * @author Christoph Strobl * @author Shashank Sharma * @see https://docs.mongodb.com/manual/reference/operator/aggregation/in/ + * "https://docs.mongodb.com/manual/reference/operator/aggregation/in/">https://docs.mongodb.com/manual/reference/operator/aggregation/in/ * @since 2.2 */ public static class In extends AbstractAggregationExpression { @@ -1645,7 +1693,7 @@ public class ArrayOperators { * Start creating {@link In}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link InBuilder} to create {@link In}. */ public static InBuilder arrayOf(String fieldReference) { @@ -1662,7 +1710,7 @@ public class ArrayOperators { * Start creating {@link In}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link InBuilder} to create {@link In}. */ public static InBuilder arrayOf(AggregationExpression expression) { @@ -1704,7 +1752,7 @@ public class ArrayOperators { * Set the {@literal value} to check for existence in the array. * * @param value must not be {@literal value}. - * @return + * @return new instance of {@link In}. */ In containsValue(Object value); } @@ -1716,7 +1764,7 @@ public class ArrayOperators { * * @author Christoph Strobl * @see https://docs.mongodb.com/manual/reference/operator/aggregation/arrayToObject/ + * "https://docs.mongodb.com/manual/reference/operator/aggregation/arrayToObject/">https://docs.mongodb.com/manual/reference/operator/aggregation/arrayToObject/ * @since 2.1 */ public static class ArrayToObject extends AbstractAggregationExpression { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/BooleanOperators.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/BooleanOperators.java index ff1b0e8e4..b651a8961 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/BooleanOperators.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/BooleanOperators.java @@ -34,7 +34,7 @@ public class BooleanOperators { * Take the array referenced by given {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link BooleanOperatorFactory}. */ public static BooleanOperatorFactory valueOf(String fieldReference) { return new BooleanOperatorFactory(fieldReference); @@ -44,7 +44,7 @@ public class BooleanOperators { * Take the value resulting of the given {@link AggregationExpression}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link BooleanOperatorFactory}. */ public static BooleanOperatorFactory valueOf(AggregationExpression fieldReference) { return new BooleanOperatorFactory(fieldReference); @@ -55,7 +55,7 @@ public class BooleanOperators { * opposite boolean value. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Not}. */ public static Not not(String fieldReference) { return Not.not(fieldReference); @@ -66,7 +66,7 @@ public class BooleanOperators { * and returns the opposite boolean value. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Not}. */ public static Not not(AggregationExpression expression) { return Not.not(expression); @@ -109,7 +109,7 @@ public class BooleanOperators { * all of the expressions are {@literal true}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link And}. */ public And and(AggregationExpression expression) { @@ -122,7 +122,7 @@ public class BooleanOperators { * all of the expressions are {@literal true}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link And}. */ public And and(String fieldReference) { @@ -139,7 +139,7 @@ public class BooleanOperators { * any of the expressions are {@literal true}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Or}. */ public Or or(AggregationExpression expression) { @@ -152,7 +152,7 @@ public class BooleanOperators { * any of the expressions are {@literal true}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Or}. */ public Or or(String fieldReference) { @@ -167,7 +167,7 @@ public class BooleanOperators { /** * Creates new {@link AggregationExpression} that evaluates a boolean and returns the opposite boolean value. * - * @return + * @return new instance of {@link Not}. */ public Not not() { return usesFieldRef() ? Not.not(fieldReference) : Not.not(expression); @@ -198,8 +198,8 @@ public class BooleanOperators { * Creates new {@link And} that evaluates one or more expressions and returns {@literal true} if all of the * expressions are {@literal true}. * - * @param expressions - * @return + * @param expressions must not be {@literal null}. + * @return new instance of {@link And}. */ public static And and(Object... expressions) { return new And(Arrays.asList(expressions)); @@ -209,7 +209,7 @@ public class BooleanOperators { * Creates new {@link And} with all previously added arguments appending the given one. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link And}. */ public And andExpression(AggregationExpression expression) { @@ -221,7 +221,7 @@ public class BooleanOperators { * Creates new {@link And} with all previously added arguments appending the given one. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link And}. */ public And andField(String fieldReference) { @@ -233,7 +233,7 @@ public class BooleanOperators { * Creates new {@link And} with all previously added arguments appending the given one. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link And}. */ public And andValue(Object value) { @@ -263,7 +263,7 @@ public class BooleanOperators { * expressions are {@literal true}. * * @param expressions must not be {@literal null}. - * @return + * @return new instance of {@link Or}. */ public static Or or(Object... expressions) { @@ -275,7 +275,7 @@ public class BooleanOperators { * Creates new {@link Or} with all previously added arguments appending the given one. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Or}. */ public Or orExpression(AggregationExpression expression) { @@ -287,7 +287,7 @@ public class BooleanOperators { * Creates new {@link Or} with all previously added arguments appending the given one. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Or}. */ public Or orField(String fieldReference) { @@ -299,7 +299,7 @@ public class BooleanOperators { * Creates new {@link Or} with all previously added arguments appending the given one. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Or}. */ public Or orValue(Object value) { @@ -329,7 +329,7 @@ public class BooleanOperators { * value. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Not}. */ public static Not not(String fieldReference) { @@ -342,7 +342,7 @@ public class BooleanOperators { * returns the opposite boolean value. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Not}. */ public static Not not(AggregationExpression expression) { 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 cbab75693..bb7e032ef 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 @@ -113,7 +113,7 @@ public class BucketAutoOperation extends BucketOperationSupport * Bucket stages collect documents into buckets and can contribute output fields.
@@ -104,7 +103,7 @@ public abstract class BucketOperationSupport andOutputExpression(String expression, Object... params); @@ -114,7 +113,7 @@ public abstract class BucketOperationSupport * Count expressions are emulated via {@code $sum: 1}. * - * @return + * @return never {@literal null}. */ public B count() { return sum(1); @@ -240,7 +239,7 @@ public abstract class BucketOperationSupport operationArguments = getOperationArguments(context); - return new Document(operation, - operationArguments.size() == 1 ? operationArguments.get(0) : operationArguments); + return new Document(operation, operationArguments.size() == 1 ? operationArguments.get(0) : operationArguments); } protected List getOperationArguments(AggregationOperationContext context) { @@ -579,7 +576,7 @@ public abstract class BucketOperationSupport conditions) { return Switch.switchCases(conditions); @@ -176,7 +176,7 @@ public class ConditionalOperators { * return expressions. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link OtherwiseBuilder} to create {@link Cond}. */ public OtherwiseBuilder then(Object value) { @@ -189,7 +189,7 @@ public class ConditionalOperators { * return expressions. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link OtherwiseBuilder} to create {@link Cond}. */ public OtherwiseBuilder thenValueOf(AggregationExpression expression) { @@ -202,7 +202,7 @@ public class ConditionalOperators { * return expressions. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link OtherwiseBuilder} to create {@link Cond}. */ public OtherwiseBuilder thenValueOf(String fieldReference) { @@ -233,9 +233,9 @@ public class ConditionalOperators { * field references}, {@link AggregationExpression expressions}, values of simple MongoDB types or values that can be * converted to a simple MongoDB type. * - * @see https://docs.mongodb.com/manual/reference/operator/aggregation/ifNull/ * @author Mark Paluch + * @see https://docs.mongodb.com/manual/reference/operator/aggregation/ifNull/ */ public static class IfNull implements AggregationExpression { @@ -251,9 +251,8 @@ public class ConditionalOperators { /** * Creates new {@link IfNull}. * - * @param fieldReference the field to check for a {@literal null} value, field reference must not be {@literal null} - * . - * @return + * @param fieldReference the field to check for a {@literal null} value, field reference must not be {@literal null}. + * @return never {@literal null}. */ public static ThenBuilder ifNull(String fieldReference) { @@ -265,8 +264,8 @@ public class ConditionalOperators { * Creates new {@link IfNull}. * * @param expression the expression to check for a {@literal null} value, field reference must not be - * {@literal null}. - * @return + * {@literal null}. + * @return never {@literal null}. */ public static ThenBuilder ifNull(AggregationExpression expression) { @@ -316,14 +315,14 @@ public class ConditionalOperators { /** * @param fieldReference the field to check for a {@literal null} value, field reference must not be - * {@literal null}. + * {@literal null}. * @return the {@link ThenBuilder} */ ThenBuilder ifNull(String fieldReference); /** * @param expression the expression to check for a {@literal null} value, field name must not be {@literal null} - * or empty. + * or empty. * @return the {@link ThenBuilder} */ ThenBuilder ifNull(AggregationExpression expression); @@ -336,21 +335,21 @@ public class ConditionalOperators { /** * @param value the value to be used if the {@code $ifNull} condition evaluates {@literal true}. Can be a - * {@link Document}, a value that is supported by MongoDB or a value that can be converted to a MongoDB - * representation but must not be {@literal null}. - * @return + * {@link Document}, a value that is supported by MongoDB or a value that can be converted to a MongoDB + * representation but must not be {@literal null}. + * @return new instance of {@link IfNull}. */ IfNull then(Object value); /** * @param fieldReference the field holding the replacement value, must not be {@literal null}. - * @return + * @return new instance of {@link IfNull}. */ IfNull thenValueOf(String fieldReference); /** * @param expression the expression yielding to the replacement value, must not be {@literal null}. - * @return + * @return new instance of {@link IfNull}. */ IfNull thenValueOf(AggregationExpression expression); } @@ -364,7 +363,8 @@ public class ConditionalOperators { private @Nullable Object condition; - private IfNullOperatorBuilder() {} + private IfNullOperatorBuilder() { + } /** * Creates a new builder for {@link IfNull}. @@ -458,9 +458,15 @@ public class ConditionalOperators { public static Switch switchCases(List conditions) { Assert.notNull(conditions, "Conditions must not be null!"); - return new Switch(Collections. singletonMap("branches", new ArrayList(conditions))); + return new Switch(Collections.singletonMap("branches", new ArrayList(conditions))); } + /** + * Set the default value. + * + * @param value must not be {@literal null}. + * @return new instance of {@link Switch}. + */ public Switch defaultTo(Object value) { return new Switch(append("default", value)); } @@ -522,7 +528,7 @@ public class ConditionalOperators { * Set the then {@literal value}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link CaseOperator}. */ CaseOperator then(Object value); } @@ -536,10 +542,10 @@ public class ConditionalOperators { * {@link AggregationExpression expressions}, values of simple MongoDB types or values that can be converted to a * simple MongoDB type. * - * @see https://docs.mongodb.com/manual/reference/operator/aggregation/cond/ * @author Mark Paluch * @author Christoph Strobl + * @see https://docs.mongodb.com/manual/reference/operator/aggregation/cond/ */ public static class Cond implements AggregationExpression { @@ -664,7 +670,6 @@ public class ConditionalOperators { } clauses.add(new Document(key, args)); - } else if (predicate instanceof Document) { Document nested = (Document) predicate; @@ -680,7 +685,6 @@ public class ConditionalOperators { args.add(nested.get(s)); clauses.add(new Document(s, args)); } - } else if (!isKeyword(key)) { List args = new ArrayList(); @@ -802,8 +806,8 @@ public class ConditionalOperators { /** * @param value the value to be used if the condition evaluates {@literal true}. Can be a {@link Document}, a - * value that is supported by MongoDB or a value that can be converted to a MongoDB representation but - * must not be {@literal null}. + * value that is supported by MongoDB or a value that can be converted to a MongoDB representation but + * must not be {@literal null}. * @return the {@link OtherwiseBuilder} */ OtherwiseBuilder then(Object value); @@ -828,8 +832,8 @@ public class ConditionalOperators { /** * @param value the value to be used if the condition evaluates {@literal false}. Can be a {@link Document}, a - * value that is supported by MongoDB or a value that can be converted to a MongoDB representation but - * must not be {@literal null}. + * value that is supported by MongoDB or a value that can be converted to a MongoDB representation but + * must not be {@literal null}. * @return the {@link Cond} */ Cond otherwise(Object value); @@ -857,7 +861,8 @@ public class ConditionalOperators { private @Nullable Object condition; private @Nullable Object thenValue; - private ConditionalExpressionBuilder() {} + private ConditionalExpressionBuilder() { + } /** * Creates a new builder for {@link Cond}. diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/CountOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/CountOperation.java index ab837f437..4306e7630 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/CountOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/CountOperation.java @@ -34,9 +34,9 @@ public class CountOperation implements FieldsExposingAggregationOperation { private final String fieldName; /** - * Creates a new {@link CountOperation} given the {@link fieldName} field name. + * Creates a new {@link CountOperation} given the {@literal fieldName} field name. * - * @param asFieldName must not be {@literal null} or empty. + * @param fieldName must not be {@literal null} or empty. */ public CountOperation(String fieldName) { @@ -71,7 +71,7 @@ public class CountOperation implements FieldsExposingAggregationOperation { * Returns the finally to be applied {@link CountOperation} with the given alias. * * @param fieldName must not be {@literal null} or empty. - * @return + * @return new instance of {@link CountOperation}. */ public CountOperation as(String fieldName) { return new CountOperation(fieldName); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DataTypeOperators.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DataTypeOperators.java index 910c65809..9ce1f314f 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DataTypeOperators.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DataTypeOperators.java @@ -30,7 +30,7 @@ public class DataTypeOperators { * Return the BSON data type of the given {@literal field}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Type}. */ public static Type typeOf(String fieldReference) { return Type.typeOf(fieldReference); @@ -56,7 +56,7 @@ public class DataTypeOperators { * Creates new {@link Type}. * * @param field must not be {@literal null}. - * @return + * @return new instance of {@link Type}. */ public static Type typeOf(String field) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DateOperators.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DateOperators.java index b5a8ab074..6305961c4 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DateOperators.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/DateOperators.java @@ -37,7 +37,7 @@ public class DateOperators { * Take the date referenced by given {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link DateOperatorFactory}. */ public static DateOperatorFactory dateOf(String fieldReference) { @@ -49,7 +49,7 @@ public class DateOperators { * Take the date resulting from the given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link DateOperatorFactory}. */ public static DateOperatorFactory dateOf(AggregationExpression expression) { @@ -278,7 +278,7 @@ public class DateOperators { * Creates new {@link AggregationExpression} that returns the day of the year for a date as a number between 1 and * 366. * - * @return + * @return new instance of {@link DayOfYear}. */ public DayOfYear dayOfYear() { return applyTimezone(DayOfYear.dayOfYear(dateReference()), timezone); @@ -288,7 +288,7 @@ public class DateOperators { * Creates new {@link AggregationExpression} that returns the day of the month for a date as a number between 1 and * 31. * - * @return + * @return new instance of {@link DayOfMonth}. */ public DayOfMonth dayOfMonth() { return applyTimezone(DayOfMonth.dayOfMonth(dateReference()), timezone); @@ -298,7 +298,7 @@ public class DateOperators { * Creates new {@link AggregationExpression} that returns the day of the week for a date as a number between 1 * (Sunday) and 7 (Saturday). * - * @return + * @return new instance of {@link DayOfWeek}. */ public DayOfWeek dayOfWeek() { return applyTimezone(DayOfWeek.dayOfWeek(dateReference()), timezone); @@ -307,7 +307,7 @@ public class DateOperators { /** * Creates new {@link AggregationExpression} that returns the year portion of a date. * - * @return + * @return new instance of {@link Year}. */ public Year year() { return applyTimezone(Year.year(dateReference()), timezone); @@ -316,7 +316,7 @@ public class DateOperators { /** * Creates new {@link AggregationExpression} that returns the month of a date as a number between 1 and 12. * - * @return + * @return new instance of {@link Month}. */ public Month month() { return applyTimezone(Month.month(dateReference()), timezone); @@ -326,7 +326,7 @@ public class DateOperators { * Creates new {@link AggregationExpression} that returns the week of the year for a date as a number between 0 and * 53. * - * @return + * @return new instance of {@link Week}. */ public Week week() { return applyTimezone(Week.week(dateReference()), timezone); @@ -335,7 +335,7 @@ public class DateOperators { /** * Creates new {@link AggregationExpression} that returns the hour portion of a date as a number between 0 and 23. * - * @return + * @return new instance of {@link Hour}. */ public Hour hour() { return applyTimezone(Hour.hour(dateReference()), timezone); @@ -344,7 +344,7 @@ public class DateOperators { /** * Creates new {@link AggregationExpression} that returns the minute portion of a date as a number between 0 and 59. * - * @return + * @return new instance of {@link Minute}. */ public Minute minute() { return applyTimezone(Minute.minute(dateReference()), timezone); @@ -354,7 +354,7 @@ public class DateOperators { * Creates new {@link AggregationExpression} that returns the second portion of a date as a number between 0 and 59, * but can be 60 to account for leap seconds. * - * @return + * @return new instance of {@link Second}. */ public Second second() { return applyTimezone(Second.second(dateReference()), timezone); @@ -364,7 +364,7 @@ public class DateOperators { * Creates new {@link AggregationExpression} that returns the millisecond portion of a date as an integer between 0 * and 999. * - * @return + * @return new instance of {@link Millisecond}. */ public Millisecond millisecond() { return applyTimezone(Millisecond.millisecond(dateReference()), timezone); @@ -375,7 +375,7 @@ public class DateOperators { * {@literal format}. * * @param format must not be {@literal null}. - * @return + * @return new instance of {@link DateToString}. */ public DateToString toString(String format) { return applyTimezone(DateToString.dateToString(dateReference()).toString(format), timezone); @@ -396,7 +396,7 @@ public class DateOperators { * Creates new {@link AggregationExpression} that returns the weekday number in ISO 8601-2018 format, ranging from 1 * (for Monday) to 7 (for Sunday). * - * @return + * @return new instance of {@link IsoDayOfWeek}. */ public IsoDayOfWeek isoDayOfWeek() { return applyTimezone(IsoDayOfWeek.isoDayWeek(dateReference()), timezone); @@ -406,7 +406,7 @@ public class DateOperators { * Creates new {@link AggregationExpression} that returns the week number in ISO 8601-2018 format, ranging from 1 to * 53. * - * @return + * @return new instance of {@link IsoWeek}. */ public IsoWeek isoWeek() { return applyTimezone(IsoWeek.isoWeek(dateReference()), timezone); @@ -415,7 +415,7 @@ public class DateOperators { /** * Creates new {@link AggregationExpression} that returns the year number in ISO 8601-2018 format. * - * @return + * @return new instance of {@link IsoWeekYear}. */ public IsoWeekYear isoWeekYear() { return applyTimezone(IsoWeekYear.isoWeekYear(dateReference()), timezone); @@ -642,7 +642,7 @@ public class DateOperators { * Creates new {@link DayOfYear}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link DayOfYear}. */ public static DayOfYear dayOfYear(String fieldReference) { @@ -654,7 +654,7 @@ public class DateOperators { * Creates new {@link DayOfYear}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link DayOfYear}. */ public static DayOfYear dayOfYear(AggregationExpression expression) { @@ -714,7 +714,7 @@ public class DateOperators { * Creates new {@link DayOfMonth}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link DayOfMonth}. */ public static DayOfMonth dayOfMonth(String fieldReference) { @@ -726,7 +726,7 @@ public class DateOperators { * Creates new {@link DayOfMonth}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link DayOfMonth}. */ public static DayOfMonth dayOfMonth(AggregationExpression expression) { @@ -786,7 +786,7 @@ public class DateOperators { * Creates new {@link DayOfWeek}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link DayOfWeek}. */ public static DayOfWeek dayOfWeek(String fieldReference) { @@ -798,7 +798,7 @@ public class DateOperators { * Creates new {@link DayOfWeek}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link DayOfWeek}. */ public static DayOfWeek dayOfWeek(AggregationExpression expression) { @@ -858,7 +858,7 @@ public class DateOperators { * Creates new {@link Year}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Year}. */ public static Year yearOf(String fieldReference) { @@ -870,7 +870,7 @@ public class DateOperators { * Creates new {@link Year}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Year}. */ public static Year yearOf(AggregationExpression expression) { @@ -930,7 +930,7 @@ public class DateOperators { * Creates new {@link Month}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Month}. */ public static Month monthOf(String fieldReference) { @@ -942,7 +942,7 @@ public class DateOperators { * Creates new {@link Month}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Month}. */ public static Month monthOf(AggregationExpression expression) { @@ -1002,7 +1002,7 @@ public class DateOperators { * Creates new {@link Week}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Week}. */ public static Week weekOf(String fieldReference) { @@ -1014,7 +1014,7 @@ public class DateOperators { * Creates new {@link Week}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Week}. */ public static Week weekOf(AggregationExpression expression) { @@ -1074,7 +1074,7 @@ public class DateOperators { * Creates new {@link Hour}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Hour}. */ public static Hour hourOf(String fieldReference) { @@ -1086,7 +1086,7 @@ public class DateOperators { * Creates new {@link Hour}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Hour}. */ public static Hour hourOf(AggregationExpression expression) { @@ -1146,7 +1146,7 @@ public class DateOperators { * Creates new {@link Minute}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Minute}. */ public static Minute minuteOf(String fieldReference) { @@ -1158,7 +1158,7 @@ public class DateOperators { * Creates new {@link Minute}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Minute}. */ public static Minute minuteOf(AggregationExpression expression) { @@ -1218,7 +1218,7 @@ public class DateOperators { * Creates new {@link Second}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Second}. */ public static Second secondOf(String fieldReference) { @@ -1230,7 +1230,7 @@ public class DateOperators { * Creates new {@link Second}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Second}. */ public static Second secondOf(AggregationExpression expression) { @@ -1290,7 +1290,7 @@ public class DateOperators { * Creates new {@link Millisecond}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Millisecond}. */ public static Millisecond millisecondOf(String fieldReference) { @@ -1302,7 +1302,7 @@ public class DateOperators { * Creates new {@link Millisecond}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Millisecond}. */ public static Millisecond millisecondOf(AggregationExpression expression) { @@ -1376,7 +1376,7 @@ public class DateOperators { * Creates new {@link FormatBuilder} allowing to define the date format to apply. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link FormatBuilder} to crate {@link DateToString}. */ public static FormatBuilder dateOf(final String fieldReference) { @@ -1388,7 +1388,7 @@ public class DateOperators { * Creates new {@link FormatBuilder} allowing to define the date format to apply. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link FormatBuilder} to crate {@link DateToString}. */ public static FormatBuilder dateOf(final AggregationExpression expression) { @@ -1540,7 +1540,7 @@ public class DateOperators { * Creates new {@link IsoDayOfWeek}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link IsoDayOfWeek}. */ public static IsoDayOfWeek isoDayOfWeek(String fieldReference) { @@ -1552,7 +1552,7 @@ public class DateOperators { * Creates new {@link IsoDayOfWeek}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IsoDayOfWeek}. */ public static IsoDayOfWeek isoDayOfWeek(AggregationExpression expression) { @@ -1612,7 +1612,7 @@ public class DateOperators { * Creates new {@link IsoWeek}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link IsoWeek}. */ public static IsoWeek isoWeekOf(String fieldReference) { @@ -1624,7 +1624,7 @@ public class DateOperators { * Creates new {@link IsoWeek}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IsoWeek}. */ public static IsoWeek isoWeekOf(AggregationExpression expression) { @@ -1684,7 +1684,7 @@ public class DateOperators { * Creates new {@link IsoWeekYear}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link IsoWeekYear}. */ public static IsoWeekYear isoWeekYearOf(String fieldReference) { @@ -1696,7 +1696,7 @@ public class DateOperators { * Creates new {@link Millisecond}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IsoWeekYear}. */ public static IsoWeekYear isoWeekYearOf(AggregationExpression expression) { @@ -2378,6 +2378,7 @@ public class DateOperators { @SuppressWarnings("unchecked") private static T applyTimezone(T instance, Timezone timezone) { return !ObjectUtils.nullSafeEquals(Timezone.none(), timezone) && !instance.hasTimezone() - ? (T) instance.withTimezone(timezone) : instance; + ? (T) instance.withTimezone(timezone) + : instance; } } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ExposedFields.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ExposedFields.java index 21d2d24be..fa09bf302 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ExposedFields.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ExposedFields.java @@ -46,7 +46,7 @@ public final class ExposedFields implements Iterable { /** * Returns an empty {@link ExposedFields} instance. * - * @return + * @return never {@literal null}. * @since 2.0 */ public static ExposedFields empty() { @@ -57,7 +57,7 @@ public final class ExposedFields implements Iterable { * Creates a new {@link ExposedFields} instance from the given {@link ExposedField}s. * * @param fields must not be {@literal null}. - * @return + * @return never {@literal null}. */ public static ExposedFields from(ExposedField... fields) { return from(Arrays.asList(fields)); @@ -67,7 +67,7 @@ public final class ExposedFields implements Iterable { * Creates a new {@link ExposedFields} instance from the given {@link ExposedField}s. * * @param fields must not be {@literal null}. - * @return + * @return never {@literal null}. */ private static ExposedFields from(List fields) { @@ -84,7 +84,7 @@ public final class ExposedFields implements Iterable { * Creates synthetic {@link ExposedFields} from the given {@link Fields}. * * @param fields must not be {@literal null}. - * @return + * @return never {@literal null}. */ public static ExposedFields synthetic(Fields fields) { return createFields(fields, true); @@ -94,7 +94,7 @@ public final class ExposedFields implements Iterable { * Creates non-synthetic {@link ExposedFields} from the given {@link Fields}. * * @param fields must not be {@literal null}. - * @return + * @return never {@literal null}. */ public static ExposedFields nonSynthetic(Fields fields) { return createFields(fields, false); @@ -105,7 +105,7 @@ public final class ExposedFields implements Iterable { * * @param fields must not be {@literal null}. * @param synthetic - * @return + * @return never {@literal null}. */ private static ExposedFields createFields(Fields fields, boolean synthetic) { @@ -135,7 +135,7 @@ public final class ExposedFields implements Iterable { * Creates a new {@link ExposedFields} adding the given {@link ExposedField}. * * @param field must not be {@literal null}. - * @return + * @return new instance of {@link ExposedFields}. */ public ExposedFields and(ExposedField field) { @@ -151,8 +151,8 @@ public final class ExposedFields implements Iterable { /** * Returns the field with the given name or {@literal null} if no field with the given name is available. * - * @param name - * @return + * @param name must not be {@literal null}. + * @return can be {@literal null}. */ @Nullable public ExposedField getField(String name) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/GraphLookupOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/GraphLookupOperation.java index 0cee34373..dc047ab87 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/GraphLookupOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/GraphLookupOperation.java @@ -146,7 +146,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation * Set the {@literal collectionName} to apply the {@code $graphLookup} to. * * @param collectionName must not be {@literal null} or empty. - * @return + * @return never {@literal null}. */ StartWithBuilder from(String collectionName); } @@ -161,7 +161,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation * Set the startWith {@literal fieldReferences} to apply the {@code $graphLookup} to. * * @param fieldReferences must not be {@literal null}. - * @return + * @return never {@literal null}. */ ConnectFromBuilder startWith(String... fieldReferences); @@ -169,7 +169,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation * Set the startWith {@literal expressions} to apply the {@code $graphLookup} to. * * @param expressions must not be {@literal null}. - * @return + * @return never {@literal null}. */ ConnectFromBuilder startWith(AggregationExpression... expressions); @@ -178,7 +178,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation * {@link AggregationExpression} to apply the {@code $graphLookup} to. * * @param expressions must not be {@literal null}. - * @return + * @return never {@literal null}. * @throws IllegalArgumentException */ ConnectFromBuilder startWith(Object... expressions); @@ -193,7 +193,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation * Set the connectFrom {@literal fieldName} to apply the {@code $graphLookup} to. * * @param fieldName must not be {@literal null} or empty. - * @return + * @return never {@literal null}. */ ConnectToBuilder connectFrom(String fieldName); } @@ -207,7 +207,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation * Set the connectTo {@literal fieldName} to apply the {@code $graphLookup} to. * * @param fieldName must not be {@literal null} or empty. - * @return + * @return never {@literal null}. */ GraphLookupOperationBuilder connectTo(String fieldName); } @@ -360,7 +360,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation * Optionally limit the number of recursions. * * @param numberOfRecursions must be greater or equal to zero. - * @return + * @return this. */ public GraphLookupOperationBuilder maxDepth(long numberOfRecursions) { @@ -374,7 +374,7 @@ public class GraphLookupOperation implements InheritsFieldsAggregationOperation * Optionally add a depth field {@literal fieldName} to each traversed document in the search path. * * @param fieldName must not be {@literal null} or empty. - * @return + * @return this. */ public GraphLookupOperationBuilder depthField(String fieldName) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/LookupOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/LookupOperation.java index 05913eb60..cddd94d25 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/LookupOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/LookupOperation.java @@ -89,7 +89,7 @@ public class LookupOperation implements FieldsExposingAggregationOperation, Inhe /** * Get a builder that allows creation of {@link LookupOperation}. * - * @return + * @return never {@literal null}. */ public static FromBuilder newLookup() { return new LookupOperationBuilder(); @@ -99,7 +99,7 @@ public class LookupOperation implements FieldsExposingAggregationOperation, Inhe /** * @param name the collection in the same database to perform the join with, must not be {@literal null} or empty. - * @return + * @return never {@literal null}. */ LocalFieldBuilder from(String name); } @@ -109,7 +109,7 @@ public class LookupOperation implements FieldsExposingAggregationOperation, Inhe /** * @param name the field from the documents input to the {@code $lookup} stage, must not be {@literal null} or * empty. - * @return + * @return never {@literal null}. */ ForeignFieldBuilder localField(String name); } @@ -118,7 +118,7 @@ public class LookupOperation implements FieldsExposingAggregationOperation, Inhe /** * @param name the field from the documents in the {@code from} collection, must not be {@literal null} or empty. - * @return + * @return never {@literal null}. */ AsBuilder foreignField(String name); } @@ -127,7 +127,7 @@ public class LookupOperation implements FieldsExposingAggregationOperation, Inhe /** * @param name the name of the new array field to add to the input documents, must not be {@literal null} or empty. - * @return + * @return new instance of {@link LookupOperation}. */ LookupOperation as(String name); } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/MergeOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/MergeOperation.java index cae54d394..b05287495 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/MergeOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/MergeOperation.java @@ -186,7 +186,7 @@ public class MergeOperation implements FieldsExposingAggregationOperation, Inher /** * Merge Documents by using the MongoDB {@literal _id} field. * - * @return + * @return never {@literal null}. */ public static UniqueMergeId id() { return ID; @@ -375,7 +375,7 @@ public class MergeOperation implements FieldsExposingAggregationOperation, Inher /** * Factory method creating {@link WhenDocumentsDontMatch} from a {@code value} literal. * - * @param value + * @param value must not be {@literal null}. * @return new instance of {@link WhenDocumentsDontMatch}. */ public static WhenDocumentsDontMatch whenNotMatchedOf(String value) { @@ -403,7 +403,7 @@ public class MergeOperation implements FieldsExposingAggregationOperation, Inher /** * Stop and fail the aggregation operation. Does not revert already performed changes on previous documents. * - * @return + * @return new instance of {@link WhenDocumentsDontMatch}. */ public static WhenDocumentsDontMatch failWhenNotMatch() { return whenNotMatchedOf("fail"); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ReplaceRootOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ReplaceRootOperation.java index 0bf5341c3..e109d7848 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ReplaceRootOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ReplaceRootOperation.java @@ -346,7 +346,7 @@ public class ReplaceRootOperation implements FieldsExposingAggregationOperation /** * Creates a {@link ReplacementDocument} given {@link ReplacementContributor}. * - * @param contributor + * @param contributor must not be {@literal null}. */ protected ReplacementDocument(ReplacementContributor contributor) { @@ -362,7 +362,7 @@ public class ReplaceRootOperation implements FieldsExposingAggregationOperation * Creates a {@link ReplacementDocument} given a {@literal value}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link ReplacementDocument}. */ public static ReplacementDocument valueOf(Object value) { return new ReplacementDocument(new DocumentContributor(value)); @@ -372,7 +372,7 @@ public class ReplaceRootOperation implements FieldsExposingAggregationOperation * Creates a {@link ReplacementDocument} given a single {@literal field} and {@link AggregationExpression}. * * @param aggregationExpression must not be {@literal null}. - * @return + * @return new instance of {@link ReplacementDocument}. */ public static ReplacementDocument forExpression(String field, AggregationExpression aggregationExpression) { return new ReplacementDocument(new ExpressionFieldContributor(Fields.field(field), aggregationExpression)); @@ -382,7 +382,7 @@ public class ReplaceRootOperation implements FieldsExposingAggregationOperation * Creates a {@link ReplacementDocument} given a single {@literal field} and {@literal value}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link ReplacementDocument}. */ public static ReplacementDocument forSingleValue(String field, Object value) { return new ReplacementDocument(new ValueFieldContributor(Fields.field(field), value)); @@ -438,7 +438,7 @@ public class ReplaceRootOperation implements FieldsExposingAggregationOperation * {@link AggregationOperationContext}. * * @param context will never be {@literal null}. - * @return + * @return never {@literal null}. */ Document toDocument(AggregationOperationContext context); } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ReplaceWithOperation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ReplaceWithOperation.java index 60bdcdc3a..9fb7249e4 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ReplaceWithOperation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/ReplaceWithOperation.java @@ -57,7 +57,7 @@ public class ReplaceWithOperation extends ReplaceRootOperation { * {@link Field field reference}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link ReplaceWithOperation}. */ public static ReplaceWithOperation replaceWithValueOf(Object value) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/SetOperators.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/SetOperators.java index b26ad24c2..874ce7189 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/SetOperators.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/SetOperators.java @@ -34,7 +34,7 @@ public class SetOperators { * Take the array referenced by given {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link SetOperatorFactory}. */ public static SetOperatorFactory arrayAsSet(String fieldReference) { return new SetOperatorFactory(fieldReference); @@ -44,7 +44,7 @@ public class SetOperators { * Take the array resulting from the given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetOperatorFactory}. */ public static SetOperatorFactory arrayAsSet(AggregationExpression expression) { return new SetOperatorFactory(expression); @@ -87,7 +87,7 @@ public class SetOperators { * returns {@literal true} if they have the same distinct elements and {@literal false} otherwise. * * @param arrayReferences must not be {@literal null}. - * @return + * @return new instance of {@link SetEquals}. */ public SetEquals isEqualTo(String... arrayReferences) { return createSetEquals().isEqualTo(arrayReferences); @@ -98,7 +98,7 @@ public class SetOperators { * returns {@literal true} if they have the same distinct elements and {@literal false} otherwise. * * @param expressions must not be {@literal null}. - * @return + * @return new instance of {@link SetEquals}. */ public SetEquals isEqualTo(AggregationExpression... expressions) { return createSetEquals().isEqualTo(expressions); @@ -113,7 +113,7 @@ public class SetOperators { * arrays and returns an array that contains the elements that appear in every of those. * * @param arrayReferences must not be {@literal null}. - * @return + * @return new instance of {@link SetIntersection}. */ public SetIntersection intersects(String... arrayReferences) { return createSetIntersection().intersects(arrayReferences); @@ -124,7 +124,7 @@ public class SetOperators { * arrays and returns an array that contains the elements that appear in every of those. * * @param expressions must not be {@literal null}. - * @return + * @return new instance of {@link SetIntersection}. */ public SetIntersection intersects(AggregationExpression... expressions) { return createSetIntersection().intersects(expressions); @@ -139,7 +139,7 @@ public class SetOperators { * arrays and returns an array that contains the elements that appear in any of those. * * @param arrayReferences must not be {@literal null}. - * @return + * @return new instance of {@link SetUnion}. */ public SetUnion union(String... arrayReferences) { return createSetUnion().union(arrayReferences); @@ -150,7 +150,7 @@ public class SetOperators { * arrays and returns an array that contains the elements that appear in any of those. * * @param expressions must not be {@literal null}. - * @return + * @return new instance of {@link SetUnion}. */ public SetUnion union(AggregationExpression... expressions) { return createSetUnion().union(expressions); @@ -165,7 +165,7 @@ public class SetOperators { * containing the elements that do not exist in the given {@literal arrayReference}. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link SetDifference}. */ public SetDifference differenceTo(String arrayReference) { return createSetDifference().differenceTo(arrayReference); @@ -176,7 +176,7 @@ public class SetOperators { * containing the elements that do not exist in the given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetDifference}. */ public SetDifference differenceTo(AggregationExpression expression) { return createSetDifference().differenceTo(expression); @@ -191,7 +191,7 @@ public class SetOperators { * {@literal true} if it is a subset of the given {@literal arrayReference}. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link SetIsSubset}. */ public SetIsSubset isSubsetOf(String arrayReference) { return createSetIsSubset().isSubsetOf(arrayReference); @@ -202,7 +202,7 @@ public class SetOperators { * {@literal true} if it is a subset of the given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetIsSubset}. */ public SetIsSubset isSubsetOf(AggregationExpression expression) { return createSetIsSubset().isSubsetOf(expression); @@ -216,7 +216,7 @@ public class SetOperators { * Creates new {@link AggregationExpression} that takes array of the previously mentioned field and returns * {@literal true} if any of the elements are {@literal true} and {@literal false} otherwise. * - * @return + * @return new instance of {@link AnyElementTrue}. */ public AnyElementTrue anyElementTrue() { return usesFieldRef() ? AnyElementTrue.arrayAsSet(fieldReference) : AnyElementTrue.arrayAsSet(expression); @@ -226,7 +226,7 @@ public class SetOperators { * Creates new {@link AggregationExpression} that tkes array of the previously mentioned field and returns * {@literal true} if no elements is {@literal false}. * - * @return + * @return new instance of {@link AllElementsTrue}. */ public AllElementsTrue allElementsTrue() { return usesFieldRef() ? AllElementsTrue.arrayAsSet(fieldReference) : AllElementsTrue.arrayAsSet(expression); @@ -257,7 +257,7 @@ public class SetOperators { * Create new {@link SetEquals}. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link SetEquals}. */ public static SetEquals arrayAsSet(String arrayReference) { @@ -269,7 +269,7 @@ public class SetOperators { * Create new {@link SetEquals}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetEquals}. */ public static SetEquals arrayAsSet(AggregationExpression expression) { @@ -281,7 +281,7 @@ public class SetOperators { * Creates new {@link java.util.Set} with all previously added arguments appending the given one. * * @param arrayReferences must not be {@literal null}. - * @return + * @return new instance of {@link SetEquals}. */ public SetEquals isEqualTo(String... arrayReferences) { @@ -293,7 +293,7 @@ public class SetOperators { * Creates new {@link Sum} with all previously added arguments appending the given one. * * @param expressions must not be {@literal null}. - * @return + * @return new instance of {@link SetEquals}. */ public SetEquals isEqualTo(AggregationExpression... expressions) { @@ -305,7 +305,7 @@ public class SetOperators { * Creates new {@link Sum} with all previously added arguments appending the given one. * * @param array must not be {@literal null}. - * @return + * @return new instance of {@link SetEquals}. */ public SetEquals isEqualTo(Object[] array) { @@ -334,7 +334,7 @@ public class SetOperators { * Creates new {@link SetIntersection} * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link SetIntersection}. */ public static SetIntersection arrayAsSet(String arrayReference) { @@ -346,7 +346,7 @@ public class SetOperators { * Creates new {@link SetIntersection}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetIntersection}. */ public static SetIntersection arrayAsSet(AggregationExpression expression) { @@ -358,7 +358,7 @@ public class SetOperators { * Creates new {@link SetIntersection} with all previously added arguments appending the given one. * * @param arrayReferences must not be {@literal null}. - * @return + * @return new instance of {@link SetIntersection}. */ public SetIntersection intersects(String... arrayReferences) { @@ -370,7 +370,7 @@ public class SetOperators { * Creates new {@link SetIntersection} with all previously added arguments appending the given one. * * @param expressions must not be {@literal null}. - * @return + * @return new instance of {@link SetIntersection}. */ public SetIntersection intersects(AggregationExpression... expressions) { @@ -399,7 +399,7 @@ public class SetOperators { * Creates new {@link SetUnion}. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link SetUnion}. */ public static SetUnion arrayAsSet(String arrayReference) { @@ -411,7 +411,7 @@ public class SetOperators { * Creates new {@link SetUnion}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetUnion}. */ public static SetUnion arrayAsSet(AggregationExpression expression) { @@ -423,7 +423,7 @@ public class SetOperators { * Creates new {@link SetUnion} with all previously added arguments appending the given one. * * @param arrayReferences must not be {@literal null}. - * @return + * @return new instance of {@link SetUnion}. */ public SetUnion union(String... arrayReferences) { @@ -435,7 +435,7 @@ public class SetOperators { * Creates new {@link SetUnion} with all previously added arguments appending the given one. * * @param expressions must not be {@literal null}. - * @return + * @return new instance of {@link SetUnion}. */ public SetUnion union(AggregationExpression... expressions) { @@ -464,7 +464,7 @@ public class SetOperators { * Creates new {@link SetDifference}. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link SetDifference}. */ public static SetDifference arrayAsSet(String arrayReference) { @@ -476,7 +476,7 @@ public class SetOperators { * Creates new {@link SetDifference}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetDifference}. */ public static SetDifference arrayAsSet(AggregationExpression expression) { @@ -488,7 +488,7 @@ public class SetOperators { * Creates new {@link SetDifference} with all previously added arguments appending the given one. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link SetDifference}. */ public SetDifference differenceTo(String arrayReference) { @@ -500,7 +500,7 @@ public class SetOperators { * Creates new {@link SetDifference} with all previously added arguments appending the given one. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetDifference}. */ public SetDifference differenceTo(AggregationExpression expression) { @@ -529,7 +529,7 @@ public class SetOperators { * Creates new {@link SetIsSubset}. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link SetIsSubset}. */ public static SetIsSubset arrayAsSet(String arrayReference) { @@ -541,7 +541,7 @@ public class SetOperators { * Creates new {@link SetIsSubset}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetIsSubset}. */ public static SetIsSubset arrayAsSet(AggregationExpression expression) { @@ -553,7 +553,7 @@ public class SetOperators { * Creates new {@link SetIsSubset} with all previously added arguments appending the given one. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link SetIsSubset}. */ public SetIsSubset isSubsetOf(String arrayReference) { @@ -565,7 +565,7 @@ public class SetOperators { * Creates new {@link SetIsSubset} with all previously added arguments appending the given one. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SetIsSubset}. */ public SetIsSubset isSubsetOf(AggregationExpression expression) { @@ -594,7 +594,7 @@ public class SetOperators { * Creates new {@link AnyElementTrue}. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link AnyElementTrue}. */ public static AnyElementTrue arrayAsSet(String arrayReference) { @@ -606,7 +606,7 @@ public class SetOperators { * Creates new {@link AnyElementTrue}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link AnyElementTrue}. */ public static AnyElementTrue arrayAsSet(AggregationExpression expression) { @@ -639,7 +639,7 @@ public class SetOperators { * Creates new {@link AllElementsTrue}. * * @param arrayReference must not be {@literal null}. - * @return + * @return new instance of {@link AllElementsTrue}. */ public static AllElementsTrue arrayAsSet(String arrayReference) { @@ -651,7 +651,7 @@ public class SetOperators { * Creates new {@link AllElementsTrue}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link AllElementsTrue}. */ public static AllElementsTrue arrayAsSet(AggregationExpression expression) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/StringOperators.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/StringOperators.java index 318764845..d97ed924b 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/StringOperators.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/aggregation/StringOperators.java @@ -35,7 +35,7 @@ public class StringOperators { * Take the array referenced by given {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link StringOperatorFactory}. */ public static StringOperatorFactory valueOf(String fieldReference) { return new StringOperatorFactory(fieldReference); @@ -45,7 +45,7 @@ public class StringOperators { * Take the array referenced by given {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link StringOperatorFactory}. */ public static StringOperatorFactory valueOf(AggregationExpression fieldReference) { return new StringOperatorFactory(fieldReference); @@ -88,7 +88,7 @@ public class StringOperators { * of the referenced field to it. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Concat}. */ public Concat concatValueOf(String fieldReference) { @@ -101,7 +101,7 @@ public class StringOperators { * of the given {@link AggregationExpression} to it. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Concat}. */ public Concat concatValueOf(AggregationExpression expression) { @@ -114,7 +114,7 @@ public class StringOperators { * {@literal value} to it. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Concat}. */ public Concat concat(String value) { @@ -130,8 +130,8 @@ public class StringOperators { * Creates new {@link AggregationExpression} that takes the associated string representation and returns a substring * starting at a specified index position. * - * @param start - * @return + * @param start start index number (including) + * @return new instance of {@link Substr}. */ public Substr substring(int start) { return substring(start, -1); @@ -141,9 +141,9 @@ public class StringOperators { * Creates new {@link AggregationExpression} that takes the associated string representation and returns a substring * starting at a specified index position including the specified number of characters. * - * @param start - * @param nrOfChars - * @return + * @param start start index number (including) + * @param nrOfChars number of characters. + * @return new instance of {@link Substr}. */ public Substr substring(int start, int nrOfChars) { return createSubstr().substring(start, nrOfChars); @@ -156,7 +156,7 @@ public class StringOperators { /** * Creates new {@link AggregationExpression} that takes the associated string representation and lowers it. * - * @return + * @return new instance of {@link ToLower}. */ public ToLower toLower() { return usesFieldRef() ? ToLower.lowerValueOf(fieldReference) : ToLower.lowerValueOf(expression); @@ -165,7 +165,7 @@ public class StringOperators { /** * Creates new {@link AggregationExpression} that takes the associated string representation and uppers it. * - * @return + * @return new instance of {@link ToUpper}. */ public ToUpper toUpper() { return usesFieldRef() ? ToUpper.upperValueOf(fieldReference) : ToUpper.upperValueOf(expression); @@ -176,7 +176,7 @@ public class StringOperators { * case-insensitive comparison to the given {@literal value}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link StrCaseCmp}. */ public StrCaseCmp strCaseCmp(String value) { @@ -189,7 +189,7 @@ public class StringOperators { * case-insensitive comparison to the referenced {@literal fieldReference}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link StrCaseCmp}. */ public StrCaseCmp strCaseCmpValueOf(String fieldReference) { @@ -202,7 +202,7 @@ public class StringOperators { * case-insensitive comparison to the result of the given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link StrCaseCmp}. */ public StrCaseCmp strCaseCmpValueOf(AggregationExpression expression) { @@ -220,7 +220,7 @@ public class StringOperators { * occurrence. * * @param substring must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfBytes}. */ public IndexOfBytes indexOf(String substring) { @@ -234,7 +234,7 @@ public class StringOperators { * index (zero-based) of the first occurrence. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfBytes}. */ public IndexOfBytes indexOf(Field fieldReference) { @@ -248,7 +248,7 @@ public class StringOperators { * byte index (zero-based) of the first occurrence. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfBytes}. */ public IndexOfBytes indexOf(AggregationExpression expression) { @@ -266,7 +266,7 @@ public class StringOperators { * first occurrence. * * @param substring must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfCP}. */ public IndexOfCP indexOfCP(String substring) { @@ -280,7 +280,7 @@ public class StringOperators { * point index (zero-based) of the first occurrence. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfCP}. */ public IndexOfCP indexOfCP(Field fieldReference) { @@ -294,7 +294,7 @@ public class StringOperators { * code point index (zero-based) of the first occurrence. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfCP}. */ public IndexOfCP indexOfCP(AggregationExpression expression) { @@ -311,7 +311,7 @@ public class StringOperators { * substrings based on the given delimiter. * * @param delimiter must not be {@literal null}. - * @return + * @return new instance of {@link Split}. */ public Split split(String delimiter) { return createSplit().split(delimiter); @@ -322,7 +322,7 @@ public class StringOperators { * substrings based on the delimiter resulting from the referenced field.. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Split}. */ public Split split(Field fieldReference) { return createSplit().split(fieldReference); @@ -333,7 +333,7 @@ public class StringOperators { * substrings based on a delimiter resulting from the given {@link AggregationExpression}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Split}. */ public Split split(AggregationExpression expression) { return createSplit().split(expression); @@ -347,7 +347,7 @@ public class StringOperators { * Creates new {@link AggregationExpression} that returns the number of UTF-8 bytes in the associated string * representation. * - * @return + * @return new instance of {@link StrLenBytes}. */ public StrLenBytes length() { return usesFieldRef() ? StrLenBytes.stringLengthOf(fieldReference) : StrLenBytes.stringLengthOf(expression); @@ -357,7 +357,7 @@ public class StringOperators { * Creates new {@link AggregationExpression} that returns the number of UTF-8 code points in the associated string * representation. * - * @return + * @return new instance of {@link StrLenCP}. */ public StrLenCP lengthCP() { return usesFieldRef() ? StrLenCP.stringLengthOfCP(fieldReference) : StrLenCP.stringLengthOfCP(expression); @@ -368,7 +368,7 @@ public class StringOperators { * starting at a specified code point index position. * * @param codePointStart - * @return + * @return new instance of {@link SubstrCP}. */ public SubstrCP substringCP(int codePointStart) { return substringCP(codePointStart, -1); @@ -378,9 +378,9 @@ public class StringOperators { * Creates new {@link AggregationExpression} that takes the associated string representation and returns a substring * starting at a specified code point index position including the specified number of code points. * - * @param codePointStart + * @param codePointStart start point (including). * @param nrOfCodePoints - * @return + * @return new instance of {@link SubstrCP}. */ public SubstrCP substringCP(int codePointStart, int nrOfCodePoints) { return createSubstrCP().substringCP(codePointStart, nrOfCodePoints); @@ -541,7 +541,7 @@ public class StringOperators { * Creates new {@link Concat}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Concat}. */ public static Concat valueOf(String fieldReference) { @@ -553,7 +553,7 @@ public class StringOperators { * Creates new {@link Concat}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Concat}. */ public static Concat valueOf(AggregationExpression expression) { @@ -565,7 +565,7 @@ public class StringOperators { * Creates new {@link Concat}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link Concat}. */ public static Concat stringValue(String value) { @@ -573,18 +573,36 @@ public class StringOperators { return new Concat(Collections.singletonList(value)); } + /** + * Concat the value of the given field. + * + * @param fieldReference must not be {@literal null}. + * @return new instance of {@link Concat}. + */ public Concat concatValueOf(String fieldReference) { Assert.notNull(fieldReference, "FieldReference must not be null!"); return new Concat(append(Fields.field(fieldReference))); } + /** + * Concat the value resulting from the given {@link AggregationExpression}. + * + * @param expression must not be {@literal null}. + * @return new instance of {@link Concat}. + */ public Concat concatValueOf(AggregationExpression expression) { Assert.notNull(expression, "Expression must not be null!"); return new Concat(append(expression)); } + /** + * Concat the given value. + * + * @param value must not be {@literal null}. + * @return new instance of {@link Concat}. + */ public Concat concat(String value) { return new Concat(append(value)); } @@ -610,7 +628,7 @@ public class StringOperators { * Creates new {@link Substr}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Substr}. */ public static Substr valueOf(String fieldReference) { @@ -622,7 +640,7 @@ public class StringOperators { * Creates new {@link Substr}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Substr}. */ public static Substr valueOf(AggregationExpression expression) { @@ -630,10 +648,19 @@ public class StringOperators { return new Substr(Collections.singletonList(expression)); } + /** + * @param start start index (including) + * @return new instance of {@link Substr}. + */ public Substr substring(int start) { return substring(start, -1); } + /** + * @param start start index (including) + * @param nrOfChars + * @return new instance of {@link Substr}. + */ public Substr substring(int start, int nrOfChars) { return new Substr(append(Arrays.asList(start, nrOfChars))); } @@ -777,7 +804,7 @@ public class StringOperators { * Creates new {@link StrCaseCmp}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link StrCaseCmp}. */ public static StrCaseCmp valueOf(AggregationExpression expression) { @@ -789,7 +816,7 @@ public class StringOperators { * Creates new {@link StrCaseCmp}. * * @param value must not be {@literal null}. - * @return + * @return new instance of {@link StrCaseCmp}. */ public static StrCaseCmp stringValue(String value) { @@ -834,7 +861,7 @@ public class StringOperators { * Start creating a new {@link IndexOfBytes}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link SubstringBuilder}. */ public static SubstringBuilder valueOf(String fieldReference) { @@ -846,7 +873,7 @@ public class StringOperators { * Start creating a new {@link IndexOfBytes}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SubstringBuilder}. */ public static SubstringBuilder valueOf(AggregationExpression expression) { @@ -858,7 +885,7 @@ public class StringOperators { * Optionally define the substring search start and end position. * * @param range must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfBytes}. */ public IndexOfBytes within(Range range) { return new IndexOfBytes(append(AggregationUtils.toRangeValues(range))); @@ -876,7 +903,7 @@ public class StringOperators { * Creates a new {@link IndexOfBytes} given {@literal substring}. * * @param substring must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfBytes}. */ public IndexOfBytes indexOf(String substring) { return new IndexOfBytes(Arrays.asList(stringExpression, substring)); @@ -886,7 +913,7 @@ public class StringOperators { * Creates a new {@link IndexOfBytes} given {@link AggregationExpression} that resolves to the substring. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfBytes}. */ public IndexOfBytes indexOf(AggregationExpression expression) { return new IndexOfBytes(Arrays.asList(stringExpression, expression)); @@ -896,7 +923,7 @@ public class StringOperators { * Creates a new {@link IndexOfBytes} given {@link Field} that resolves to the substring. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfBytes}. */ public IndexOfBytes indexOf(Field fieldReference) { return new IndexOfBytes(Arrays.asList(stringExpression, fieldReference)); @@ -924,7 +951,7 @@ public class StringOperators { * Start creating a new {@link IndexOfCP}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfCP}. */ public static SubstringBuilder valueOf(String fieldReference) { @@ -936,7 +963,7 @@ public class StringOperators { * Start creating a new {@link IndexOfCP}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfCP}. */ public static SubstringBuilder valueOf(AggregationExpression expression) { @@ -948,7 +975,7 @@ public class StringOperators { * Optionally define the substring search start and end position. * * @param range must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfCP}. */ public IndexOfCP within(Range range) { return new IndexOfCP(append(AggregationUtils.toRangeValues(range))); @@ -966,7 +993,7 @@ public class StringOperators { * Creates a new {@link IndexOfCP} given {@literal substring}. * * @param substring must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfCP}. */ public IndexOfCP indexOf(String substring) { return new IndexOfCP(Arrays.asList(stringExpression, substring)); @@ -976,7 +1003,7 @@ public class StringOperators { * Creates a new {@link IndexOfCP} given {@link AggregationExpression} that resolves to the substring. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link IndexOfCP}. */ public IndexOfCP indexOf(AggregationExpression expression) { return new IndexOfCP(Arrays.asList(stringExpression, expression)); @@ -1014,7 +1041,7 @@ public class StringOperators { * Start creating a new {@link Split}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Split}. */ public static Split valueOf(String fieldReference) { @@ -1026,7 +1053,7 @@ public class StringOperators { * Start creating a new {@link Split}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Split}. */ public static Split valueOf(AggregationExpression expression) { @@ -1038,7 +1065,7 @@ public class StringOperators { * Use given {@link String} as delimiter. * * @param delimiter must not be {@literal null}. - * @return + * @return new instance of {@link Split}. */ public Split split(String delimiter) { @@ -1050,7 +1077,7 @@ public class StringOperators { * Use value of referenced field as delimiter. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link Split}. */ public Split split(Field fieldReference) { @@ -1062,7 +1089,7 @@ public class StringOperators { * Use value resulting from {@link AggregationExpression} as delimiter. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link Split}. */ public Split split(AggregationExpression expression) { @@ -1091,7 +1118,7 @@ public class StringOperators { * Creates new {@link StrLenBytes}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link StrLenBytes}. */ public static StrLenBytes stringLengthOf(String fieldReference) { return new StrLenBytes(Fields.field(fieldReference)); @@ -1101,7 +1128,7 @@ public class StringOperators { * Creates new {@link StrLenBytes}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link StrLenBytes}. */ public static StrLenBytes stringLengthOf(AggregationExpression expression) { @@ -1130,7 +1157,7 @@ public class StringOperators { * Creates new {@link StrLenCP}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link StrLenCP}. */ public static StrLenCP stringLengthOfCP(String fieldReference) { return new StrLenCP(Fields.field(fieldReference)); @@ -1140,7 +1167,7 @@ public class StringOperators { * Creates new {@link StrLenCP}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link StrLenCP}. */ public static StrLenCP stringLengthOfCP(AggregationExpression expression) { @@ -1169,7 +1196,7 @@ public class StringOperators { * Creates new {@link SubstrCP}. * * @param fieldReference must not be {@literal null}. - * @return + * @return new instance of {@link SubstrCP}. */ public static SubstrCP valueOf(String fieldReference) { @@ -1181,7 +1208,7 @@ public class StringOperators { * Creates new {@link SubstrCP}. * * @param expression must not be {@literal null}. - * @return + * @return new instance of {@link SubstrCP}. */ public static SubstrCP valueOf(AggregationExpression expression) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/AbstractMongoConverter.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/AbstractMongoConverter.java index d4546b9e1..3233c3023 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/AbstractMongoConverter.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/AbstractMongoConverter.java @@ -72,7 +72,7 @@ public abstract class AbstractMongoConverter implements MongoConverter, Initiali /** * Registers {@link EntityInstantiators} to customize entity instantiation. * - * @param instantiators + * @param instantiators can be {@literal null}. Uses default {@link EntityInstantiators} if so. */ public void setInstantiators(@Nullable EntityInstantiators instantiators) { this.instantiators = instantiators == null ? new EntityInstantiators() : instantiators; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/CustomConversions.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/CustomConversions.java index 2f0569bd4..41066052d 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/CustomConversions.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/CustomConversions.java @@ -46,7 +46,7 @@ public class CustomConversions extends MongoCustomConversions { /** * Creates a new {@link CustomConversions} instance registering the given converters. * - * @param converters + * @param converters must not be {@literal null}. */ public CustomConversions(List converters) { super(converters); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DbRefResolver.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DbRefResolver.java index 04ddc9711..18b2695e9 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DbRefResolver.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DbRefResolver.java @@ -45,7 +45,7 @@ public interface DbRefResolver { * @param property will never be {@literal null}. * @param dbref the {@link DBRef} to resolve. * @param callback will never be {@literal null}. - * @return + * @return can be {@literal null}. */ @Nullable Object resolveDbRef(MongoPersistentProperty property, @Nullable DBRef dbref, DbRefResolverCallback callback, @@ -58,7 +58,7 @@ public interface DbRefResolver { * @param annotation will never be {@literal null}. * @param entity will never be {@literal null}. * @param id will never be {@literal null}. - * @return + * @return new instance of {@link DBRef}. */ default DBRef createDbRef(@Nullable org.springframework.data.mongodb.core.mapping.DBRef annotation, MongoPersistentEntity entity, Object id) { @@ -74,7 +74,7 @@ public interface DbRefResolver { * Actually loads the {@link DBRef} from the datasource. * * @param dbRef must not be {@literal null}. - * @return + * @return can be {@literal null}. * @since 1.7 */ @Nullable diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DefaultMongoTypeMapper.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DefaultMongoTypeMapper.java index fe3ac71fb..606221deb 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DefaultMongoTypeMapper.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DefaultMongoTypeMapper.java @@ -23,7 +23,6 @@ import java.util.function.UnaryOperator; import org.bson.Document; import org.bson.conversions.Bson; - import org.springframework.data.convert.CustomConversions; import org.springframework.data.convert.DefaultTypeMapper; import org.springframework.data.convert.SimpleTypeInformationMapper; @@ -42,9 +41,7 @@ import com.mongodb.DBObject; /** * Default implementation of {@link MongoTypeMapper} allowing configuration of the key to lookup and store type - * information in {@link Document}. The key defaults to {@link #DEFAULT_TYPE_KEY}. Actual type-to-{@link String} - * conversion and back is done in {@link #getTypeString(TypeInformation)} or {@link #getTypeInformation(String)} - * respectively. + * information in {@link Document}. The key defaults to {@link #DEFAULT_TYPE_KEY}. * * @author Oliver Gierke * @author Thomas Darimont @@ -111,7 +108,7 @@ public class DefaultMongoTypeMapper extends DefaultTypeMapper implements M * {@link TypeInformationMapper} to map type hints. * * @param typeKey name of the field to read and write type hints. Can be {@literal null} to disable type hints. - * @param mappers + * @param mappers must not be {@literal null}. */ public DefaultMongoTypeMapper(@Nullable String typeKey, List mappers) { this(typeKey, new DocumentTypeAliasAccessor(typeKey), null, mappers); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DocumentAccessor.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DocumentAccessor.java index 570997617..9522a60ce 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DocumentAccessor.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DocumentAccessor.java @@ -70,10 +70,10 @@ class DocumentAccessor { /** * Puts the given value into the backing {@link Document} based on the coordinates defined through the given * {@link MongoPersistentProperty}. By default this will be the plain field name. But field names might also consist - * of path traversals so we might need to create intermediate {@link BasicDocument}s. + * of path traversals so we might need to create intermediate {@link Document}s. * * @param prop must not be {@literal null}. - * @param value + * @param value can be {@literal null}. */ public void put(MongoPersistentProperty prop, @Nullable Object value) { @@ -106,7 +106,7 @@ class DocumentAccessor { * a path expression in the field name metadata. * * @param property must not be {@literal null}. - * @return + * @return can be {@literal null}. */ @Nullable public Object get(MongoPersistentProperty property) { @@ -150,7 +150,7 @@ class DocumentAccessor { * {@link MongoPersistentProperty}. * * @param property must not be {@literal null}. - * @return + * @return {@literal true} if no non {@literal null} value present. */ @SuppressWarnings("unchecked") public boolean hasValue(MongoPersistentProperty property) { @@ -203,7 +203,7 @@ class DocumentAccessor { * Returns the given source object as map, i.e. {@link Document}s and maps as is or {@literal null} otherwise. * * @param source can be {@literal null}. - * @return + * @return can be {@literal null}. */ @Nullable @SuppressWarnings("unchecked") diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/GeoConverters.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/GeoConverters.java index 1b00add6b..4437a95d3 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/GeoConverters.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/GeoConverters.java @@ -91,7 +91,7 @@ abstract class GeoConverters { /** * Returns the geo converters to be registered. * - * @return + * @return never {@literal null}. */ @SuppressWarnings("unchecked") public static Collection getConvertersToRegister() { @@ -817,8 +817,8 @@ abstract class GeoConverters { /** * Converts a coordinate pairs nested in in {@link BasicDBList} into {@link GeoJsonPoint}s. * - * @param listOfCoordinatePairs - * @return + * @param listOfCoordinatePairs must not be {@literal null}. + * @return never {@literal null}. * @since 1.7 */ @SuppressWarnings("unchecked") @@ -841,8 +841,8 @@ abstract class GeoConverters { /** * Converts a coordinate pairs nested in in {@link BasicDBList} into {@link GeoJsonPolygon}. * - * @param dbList - * @return + * @param dbList must not be {@literal null}. + * @return never {@literal null}. * @since 1.7 */ static GeoJsonPolygon toGeoJsonPolygon(List dbList) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java index 3ca5e2156..24ac18171 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java @@ -497,7 +497,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App * Root entry method into write conversion. Adds a type discriminator to the {@link Document}. Shouldn't be called for * nested conversions. * - * @see org.springframework.data.mongodb.core.convert.MongoWriter#write(java.lang.Object, com.mongodb.Document) + * @see org.springframework.data.mongodb.core.convert.MongoWriter#write(java.lang.Object, java.lang.Object) */ public void write(Object obj, Bson bson) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverter.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverter.java index 9269e09b8..c5e447c9c 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverter.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MongoConverter.java @@ -119,8 +119,8 @@ public interface MongoConverter /** * Converts the given raw id value into either {@link ObjectId} or {@link String}. * - * @param id - * @param targetType + * @param id can be {@literal null}. + * @param targetType must not be {@literal null}. * @return {@literal null} if source {@literal id} is already {@literal null}. * @since 2.2 */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java index ec18d0767..884446cf8 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java @@ -816,7 +816,7 @@ public class QueryMapper { protected final String name; /** - * Creates a new {@link DocumentField} without meta-information but the given name. + * Creates a new {@link Field} without meta-information but the given name. * * @param name must not be {@literal null} or empty. */ @@ -827,7 +827,7 @@ public class QueryMapper { } /** - * Returns a new {@link DocumentField} with the given name. + * Returns a new {@link Field} with the given name. * * @param name must not be {@literal null} or empty. * @return diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/ValueResolver.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/ValueResolver.java index f18593c3b..0fa9429e4 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/ValueResolver.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/ValueResolver.java @@ -37,7 +37,7 @@ interface ValueResolver { * @param prop * @param bson * @param evaluator - * @param parent + * @param path * @return */ @Nullable diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJson.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJson.java index 8e1a3c923..5c07fb8d1 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJson.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/geo/GeoJson.java @@ -16,7 +16,7 @@ package org.springframework.data.mongodb.core.geo; /** - * Interface definition for structures defined in GeoJSON ({@link https://geojson.org/}) format. + * Interface definition for structures defined in https://docs.mongodb.org/manual/core/index-unique/ */ @@ -97,14 +97,14 @@ public @interface CompoundIndex { /** * If set to true index will skip over any document that is missing the indexed field. * - * @return + * @return {@literal false} by default. * @see https://docs.mongodb.org/manual/core/index-sparse/ */ boolean sparse() default false; /** - * @return + * @return {@literal false} by default. * @see https://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-dropping * @deprecated since 2.1. No longer supported by MongoDB as of server version 3.0. @@ -148,7 +148,7 @@ public @interface CompoundIndex { * db.hybrid.createIndex( { h1: 1, h2: 1 } , { name: "compound_index" } ) * * - * @return + * @return empty String by default. */ String name() default ""; @@ -156,7 +156,7 @@ public @interface CompoundIndex { * If set to {@literal true} then MongoDB will ignore the given index name and instead generate a new name. Defaults * to {@literal false}. * - * @return + * @return {@literal false} by default * @since 1.5 */ boolean useGeneratedName() default false; @@ -164,7 +164,7 @@ public @interface CompoundIndex { /** * If {@literal true} the index will be created in the background. * - * @return + * @return {@literal false} by default. * @see https://docs.mongodb.org/manual/core/indexes/#background-construction */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeoSpatialIndexed.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeoSpatialIndexed.java index e0f7d4da9..9da756240 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeoSpatialIndexed.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeoSpatialIndexed.java @@ -72,7 +72,7 @@ public @interface GeoSpatialIndexed { * * * - * @return + * @return empty {@link String} by default. */ String name() default ""; @@ -80,7 +80,7 @@ public @interface GeoSpatialIndexed { * If set to {@literal true} then MongoDB will ignore the given index name and instead generate a new name. Defaults * to {@literal false}. * - * @return + * @return {@literal false} by default. * @since 1.5 */ boolean useGeneratedName() default false; @@ -88,21 +88,21 @@ public @interface GeoSpatialIndexed { /** * Minimum value for indexed values. * - * @return + * @return {@literal -180} by default. */ int min() default -180; /** * Maximum value for indexed values. * - * @return + * @return {@literal +180} by default. */ int max() default 180; /** * Bits of precision for boundary calculations. * - * @return + * @return {@literal 26} by default. */ int bits() default 26; @@ -110,7 +110,7 @@ public @interface GeoSpatialIndexed { * The type of the geospatial index. Default is {@link GeoSpatialIndexType#GEO_2D} * * @since 1.4 - * @return + * @return {@link GeoSpatialIndexType#GEO_2D} by default. */ GeoSpatialIndexType type() default GeoSpatialIndexType.GEO_2D; @@ -118,7 +118,7 @@ public @interface GeoSpatialIndexed { * The bucket size for {@link GeoSpatialIndexType#GEO_HAYSTACK} indexes, in coordinate units. * * @since 1.4 - * @return + * @return {@literal 1.0} by default. */ double bucketSize() default 1.0; @@ -126,7 +126,7 @@ public @interface GeoSpatialIndexed { * The name of the additional field to use for {@link GeoSpatialIndexType#GEO_HAYSTACK} indexes * * @since 1.4 - * @return + * @return empty {@link String} by default. */ String additionalField() default ""; } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeospatialIndex.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeospatialIndex.java index b54067d7b..997d962ac 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeospatialIndex.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/GeospatialIndex.java @@ -59,7 +59,7 @@ public class GeospatialIndex implements IndexDefinition { /** * @param name must not be {@literal null} or empty. - * @return + * @return this. */ public GeospatialIndex named(String name) { @@ -69,7 +69,7 @@ public class GeospatialIndex implements IndexDefinition { /** * @param min - * @return + * @return this. */ public GeospatialIndex withMin(int min) { this.min = Integer.valueOf(min); @@ -78,7 +78,7 @@ public class GeospatialIndex implements IndexDefinition { /** * @param max - * @return + * @return this. */ public GeospatialIndex withMax(int max) { this.max = Integer.valueOf(max); @@ -87,7 +87,7 @@ public class GeospatialIndex implements IndexDefinition { /** * @param bits - * @return + * @return this. */ public GeospatialIndex withBits(int bits) { this.bits = Integer.valueOf(bits); @@ -96,7 +96,7 @@ public class GeospatialIndex implements IndexDefinition { /** * @param type must not be {@literal null}. - * @return + * @return this. */ public GeospatialIndex typed(GeoSpatialIndexType type) { @@ -108,7 +108,7 @@ public class GeospatialIndex implements IndexDefinition { /** * @param bucketSize - * @return + * @return this. */ public GeospatialIndex withBucketSize(double bucketSize) { this.bucketSize = bucketSize; @@ -116,8 +116,8 @@ public class GeospatialIndex implements IndexDefinition { } /** - * @param fieldName. - * @return + * @param fieldName + * @return this. */ public GeospatialIndex withAdditionalField(String fieldName) { this.additionalField = fieldName; @@ -128,7 +128,7 @@ public class GeospatialIndex implements IndexDefinition { * Only index the documents in a collection that meet a specified {@link IndexFilter filter expression}. * * @param filter can be {@literal null}. - * @return + * @return this. * @see https://docs.mongodb.com/manual/core/index-partial/ * @since 1.10 @@ -146,7 +146,7 @@ public class GeospatialIndex implements IndexDefinition { * index. * * @param collation can be {@literal null}. - * @return + * @return this. * @since 2.0 */ public GeospatialIndex collation(@Nullable Collation collation) { @@ -155,6 +155,11 @@ public class GeospatialIndex implements IndexDefinition { return this; } + /* + * (non-Javadoc) + * @see org.springframework.data.mongodb.core.index.IndexDefinition#getIndexKeys() + */ + @Override public Document getIndexKeys() { Document document = new Document(); @@ -184,6 +189,11 @@ public class GeospatialIndex implements IndexDefinition { return document; } + /* + * (non-Javadoc) + * @see org.springframework.data.mongodb.core.index.IndexDefinition#getIndexOptions() + */ + @Override public Document getIndexOptions() { Document document = new Document(); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/HashedIndex.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/HashedIndex.java index 40bb8f078..4fe5093d6 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/HashedIndex.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/HashedIndex.java @@ -40,7 +40,7 @@ public class HashedIndex implements IndexDefinition { * Creates a new {@link HashedIndex} for the given field. * * @param field must not be {@literal null} nor empty. - * @return + * @return new instance of {@link HashedIndex}. */ public static HashedIndex hashed(String field) { return new HashedIndex(field); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Index.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Index.java index 363790921..6a7807ef3 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Index.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Index.java @@ -73,7 +73,7 @@ public class Index implements IndexDefinition { /** * Reject all documents that contain a duplicate value for the indexed field. * - * @return + * @return this. * @see https://docs.mongodb.org/manual/core/index-unique/ */ @@ -85,7 +85,7 @@ public class Index implements IndexDefinition { /** * Skip over any document that is missing the indexed field. * - * @return + * @return this. * @see https://docs.mongodb.org/manual/core/index-sparse/ */ @@ -97,7 +97,7 @@ public class Index implements IndexDefinition { /** * Build the index in background (non blocking). * - * @return + * @return this. * @since 1.5 */ public Index background() { @@ -110,7 +110,7 @@ public class Index implements IndexDefinition { * Specifies TTL in seconds. * * @param value - * @return + * @return this. * @since 1.5 */ public Index expire(long value) { @@ -135,8 +135,8 @@ public class Index implements IndexDefinition { * Specifies TTL with given {@link TimeUnit}. * * @param value - * @param unit - * @return + * @param unit must not be {@literal null}. + * @return this. * @since 1.5 */ public Index expire(long value, TimeUnit unit) { @@ -150,7 +150,7 @@ public class Index implements IndexDefinition { * Only index the documents in a collection that meet a specified {@link IndexFilter filter expression}. * * @param filter can be {@literal null}. - * @return + * @return this. * @see https://docs.mongodb.com/manual/core/index-partial/ * @since 1.10 @@ -168,7 +168,7 @@ public class Index implements IndexDefinition { * index. * * @param collation can be {@literal null}. - * @return + * @return this. * @since 2.0 */ public Index collation(@Nullable Collation collation) { @@ -192,6 +192,10 @@ public class Index implements IndexDefinition { return document; } + /* + * (non-Javadoc) + * @see org.springframework.data.mongodb.core.index.IndexDefinition#getIndexOptions() + */ public Document getIndexOptions() { Document document = new Document(); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexDefinition.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexDefinition.java index 2bc2c99ff..0051954a8 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexDefinition.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexDefinition.java @@ -24,7 +24,17 @@ import org.bson.Document; */ public interface IndexDefinition { + /** + * Get the {@link Document} containing properties covered by the index. + * + * @return never {@literal null}. + */ Document getIndexKeys(); + /** + * Get the index properties such as {@literal unique},... + * + * @return never {@literal null}. + */ Document getIndexOptions(); } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexField.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexField.java index dc5d5d60a..57a7912f1 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexField.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexField.java @@ -81,7 +81,7 @@ public final class IndexField { * Creates a geo {@link IndexField} for the given key. * * @param key must not be {@literal null} or empty. - * @return + * @return new instance of {@link IndexField}. */ public static IndexField geo(String key) { return new IndexField(key, null, Type.GEO); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexFilter.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexFilter.java index 02ff07d65..77689cfcc 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexFilter.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexFilter.java @@ -29,7 +29,7 @@ public interface IndexFilter { /** * Get the raw (unmapped) filter expression. * - * @return + * @return never {@literal null}. */ Document getFilterObject(); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexInfo.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexInfo.java index d3c923c42..99bbb2089 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexInfo.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexInfo.java @@ -68,8 +68,8 @@ public class IndexInfo { /** * Creates new {@link IndexInfo} parsing required properties from the given {@literal sourceDocument}. * - * @param sourceDocument - * @return + * @param sourceDocument never {@literal null}. + * @return new instance of {@link IndexInfo}. * @since 1.10 */ public static IndexInfo indexInfoOf(Document sourceDocument) { @@ -135,7 +135,7 @@ public class IndexInfo { } /** - * @param sourceDocument + * @param sourceDocument never {@literal null}. * @return the {@link String} representation of the partial filter {@link Document}. * @since 2.1.11 */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexResolver.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexResolver.java index c948898d0..4200535cd 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexResolver.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/IndexResolver.java @@ -52,7 +52,7 @@ public interface IndexResolver { * Find and create {@link IndexDefinition}s for properties of given {@link TypeInformation}. {@link IndexDefinition}s * are created for properties and types with {@link Indexed}, {@link CompoundIndexes} or {@link GeoSpatialIndexed}. * - * @param typeInformation + * @param typeInformation must not be {@literal null}. * @return Empty {@link Iterable} in case no {@link IndexDefinition} could be resolved for type. */ Iterable resolveIndexFor(TypeInformation typeInformation); @@ -61,7 +61,7 @@ public interface IndexResolver { * Find and create {@link IndexDefinition}s for properties of given {@link TypeInformation}. {@link IndexDefinition}s * are created for properties and types with {@link Indexed}, {@link CompoundIndexes} or {@link GeoSpatialIndexed}. * - * @param entityType + * @param entityType must not be {@literal null}. * @return Empty {@link Iterable} in case no {@link IndexDefinition} could be resolved for type. * @see 2.2 */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Indexed.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Indexed.java index e4fb9452c..ebaa3a96e 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Indexed.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/Indexed.java @@ -39,25 +39,30 @@ public @interface Indexed { /** * If set to true reject all documents that contain a duplicate value for the indexed field. * - * @return + * @return {@literal false} by default. * @see https://docs.mongodb.org/manual/core/index-unique/ */ boolean unique() default false; + /** + * The index sort direction. + * + * @return {@link IndexDirection#ASCENDING} by default. + */ IndexDirection direction() default IndexDirection.ASCENDING; /** * If set to true index will skip over any document that is missing the indexed field. * - * @return + * @return {@literal false} by default. * @see https://docs.mongodb.org/manual/core/index-sparse/ */ boolean sparse() default false; /** - * @return + * @return {@literal false} by default. * @see https://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-dropping * @deprecated since 2.1. No longer supported by MongoDB as of server version 3.0. @@ -105,7 +110,7 @@ public @interface Indexed { * * * - * @return + * @return empty String by default. */ String name() default ""; @@ -113,7 +118,7 @@ public @interface Indexed { * If set to {@literal true} then MongoDB will ignore the given index name and instead generate a new name. Defaults * to {@literal false}. * - * @return + * @return {@literal false} by default. * @since 1.5 */ boolean useGeneratedName() default false; @@ -121,7 +126,7 @@ public @interface Indexed { /** * If {@literal true} the index will be created in the background. * - * @return + * @return {@literal false} by default. * @see https://docs.mongodb.org/manual/core/indexes/#background-construction */ @@ -130,7 +135,7 @@ public @interface Indexed { /** * Configures the number of seconds after which the collection should expire. Defaults to -1 for no expiry. * - * @return + * @return {@literal -1} by default. * @see https://docs.mongodb.org/manual/tutorial/expire-data/ */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreator.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreator.java index 172c10590..6c37cfedd 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreator.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/index/MongoPersistentEntityIndexCreator.java @@ -77,7 +77,7 @@ public class MongoPersistentEntityIndexCreator implements ApplicationListener extends BasicPersistentEntity extends BasicPersistentEntity owner, SimpleTypeHolder simpleTypeHolder, @Nullable FieldNamingStrategy fieldNamingStrategy) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/CachingMongoPersistentProperty.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/CachingMongoPersistentProperty.java index ddda7e889..d0c1aad81 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/CachingMongoPersistentProperty.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/CachingMongoPersistentProperty.java @@ -40,13 +40,13 @@ public class CachingMongoPersistentProperty extends BasicMongoPersistentProperty /** * Creates a new {@link CachingMongoPersistentProperty}. * - * @param property - * @param owner - * @param simpleTypeHolder - * @param fieldNamingStrategy + * @param property must not be {@literal null}. + * @param owner must not be {@literal null}. + * @param simpleTypeHolder must not be {@literal null}. + * @param fieldNamingStrategy can be {@literal null}. */ public CachingMongoPersistentProperty(Property property, MongoPersistentEntity owner, - SimpleTypeHolder simpleTypeHolder, FieldNamingStrategy fieldNamingStrategy) { + SimpleTypeHolder simpleTypeHolder, @Nullable FieldNamingStrategy fieldNamingStrategy) { super(property, owner, simpleTypeHolder, fieldNamingStrategy); } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/DBRef.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/DBRef.java index 3bbbb3d7f..b7d524be8 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/DBRef.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/DBRef.java @@ -39,14 +39,14 @@ public @interface DBRef { /** * The database the referred entity resides in. * - * @return + * @return empty String by default. */ String db() default ""; /** * Controls whether the referenced entity should be loaded lazily. This defaults to {@literal false}. * - * @return + * @return {@literal false} by default. */ boolean lazy() default false; } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/Document.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/Document.java index e806477e4..c1ffd8c6c 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/Document.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/Document.java @@ -60,7 +60,7 @@ public @interface Document { /** * Defines the default language to be used with this document. * - * @return + * @return an empty String by default. * @since 1.6 */ String language() default ""; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/MongoPersistentEntity.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/MongoPersistentEntity.java index b5a3afc41..15c470538 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/MongoPersistentEntity.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/MongoPersistentEntity.java @@ -70,7 +70,7 @@ public interface MongoPersistentEntity extends PersistentEntity extends MongoMappingEvent /** * Returns the type for which the {@link AbstractDeleteEvent} shall be invoked for. * - * @return + * @return can be {@literal null}. */ @Nullable public Class getType() { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AfterDeleteEvent.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AfterDeleteEvent.java index 29a1b5855..27192183a 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AfterDeleteEvent.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AfterDeleteEvent.java @@ -33,7 +33,7 @@ public class AfterDeleteEvent extends AbstractDeleteEvent { /** * Creates a new {@link AfterDeleteEvent} for the given {@link Document}, type and collectionName. * - * @param dbo must not be {@literal null}. + * @param document must not be {@literal null}. * @param type may be {@literal null}. * @param collectionName must not be {@literal null}. * @since 1.8 diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AfterLoadEvent.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AfterLoadEvent.java index 1f9c07766..42c6da2d4 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AfterLoadEvent.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/mapping/event/AfterLoadEvent.java @@ -51,7 +51,7 @@ public class AfterLoadEvent extends MongoMappingEvent { /** * Returns the type for which the {@link AfterLoadEvent} shall be invoked for. * - * @return + * @return never {@literal null}. */ public Class getType() { return type; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/Cancelable.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/Cancelable.java index 3aee394e8..ed8038329 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/Cancelable.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/Cancelable.java @@ -28,7 +28,7 @@ public interface Cancelable { /** * Abort and free resources. * - * @throws DataAccessResourceFailureException + * @throws DataAccessResourceFailureException if operation cannot be canceled. */ void cancel() throws DataAccessResourceFailureException; } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/CursorReadingTask.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/CursorReadingTask.java index f3fa01794..405636752 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/CursorReadingTask.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/CursorReadingTask.java @@ -268,7 +268,7 @@ abstract class CursorReadingTask implements Task { * exception. * * @param callback must not be {@literal null}. - * @param + * @param * @return can be {@literal null}. * @throws RuntimeException The potentially translated exception. */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/Message.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/Message.java index 510aac276..13b27f900 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/Message.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/Message.java @@ -77,7 +77,7 @@ public interface Message { /** * The database name the message originates from. * - * @return + * @return can be {@literal null}. */ @Nullable public String getDatabaseName() { @@ -87,7 +87,7 @@ public interface Message { /** * The collection name the message originates from. * - * @return + * @return can be {@literal null}. */ @Nullable public String getCollectionName() { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/MessageListenerContainer.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/MessageListenerContainer.java index 6fdb0496d..9a43376dc 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/MessageListenerContainer.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/messaging/MessageListenerContainer.java @@ -94,7 +94,7 @@ public interface MessageListenerContainer extends SmartLifecycle { * Errors during {@link Message} retrieval lead to {@link Subscription#cancel() cannelation} of the underlying task. * * @param request must not be {@literal null}. - * @param type the exact target or a more concrete type of the {@link Message#getBody()}. + * @param bodyType the exact target or a more concrete type of the {@link Message#getBody()}. * @return never {@literal null}. */ Subscription register(SubscriptionRequest request, Class bodyType); @@ -127,7 +127,7 @@ public interface MessageListenerContainer extends SmartLifecycle { * Errors during {@link Message} retrieval are delegated to the given {@link ErrorHandler}. * * @param request must not be {@literal null}. - * @param type the exact target or a more concrete type of the {@link Message#getBody()}. Must not be {@literal null}. + * @param bodyType the exact target or a more concrete type of the {@link Message#getBody()}. Must not be {@literal null}. * @param errorHandler the callback to invoke when retrieving the {@link Message} from the data source fails for some * reason. * @return never {@literal null}. diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Collation.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Collation.java index 4b87ca81b..80428ddf6 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Collation.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Collation.java @@ -81,7 +81,7 @@ public class Collation { * {@link java.util.Locale#getVariant()}. * * @param locale must not be {@literal null}. - * @return + * @return new instance of {@link Collation}. */ public static Collation of(Locale locale) { @@ -102,7 +102,7 @@ public class Collation { * Create new {@link Collation} with locale set to the given ICU language. * * @param language must not be {@literal null}. - * @return + * @return new instance of {@link Collation}. */ public static Collation of(String language) { return of(CollationLocale.of(language)); @@ -112,7 +112,7 @@ public class Collation { * Create new {@link Collation} with locale set to the given {@link CollationLocale}. * * @param locale must not be {@literal null}. - * @return + * @return new instance of {@link Collation}. */ public static Collation of(CollationLocale locale) { return new Collation(locale); @@ -139,7 +139,7 @@ public class Collation { * Create new {@link Collation} from values in {@link Document}. * * @param source must not be {@literal null}. - * @return + * @return new instance of {@link Collation}. * @see MongoDB Reference - * Collation Document */ @@ -181,7 +181,7 @@ public class Collation { /** * Set the level of comparison to perform. * - * @param strength + * @param strength comparison level. * @return new {@link Collation}. */ public Collation strength(int strength) { @@ -206,7 +206,7 @@ public class Collation { /** * Set whether to include {@code caseLevel} comparison.
* - * @param caseLevel + * @param caseLevel use {@literal true} to enable {@code caseLevel} comparison. * @return new {@link Collation}. */ public Collation caseLevel(boolean caseLevel) { @@ -220,7 +220,7 @@ public class Collation { * Set the flag that determines sort order of case differences during tertiary level comparisons. * * @param caseFirst must not be {@literal null}. - * @return + * @return new instance of {@link Collation}. */ public Collation caseFirst(String caseFirst) { return caseFirst(new CaseFirst(caseFirst)); @@ -229,8 +229,8 @@ public class Collation { /** * Set the flag that determines sort order of case differences during tertiary level comparisons. * - * @param caseFirst must not be {@literal null}. - * @return + * @param sort must not be {@literal null}. + * @return new instance of {@link Collation}. */ public Collation caseFirst(CaseFirst sort) { @@ -372,7 +372,7 @@ public class Collation { /** * Get the {@link Document} representation of the {@link Collation}. * - * @return + * @return the native MongoDB {@link Document} representation of the {@link Collation}. */ public Document toDocument() { return map(toMongoDocumentConverter()); @@ -381,7 +381,7 @@ public class Collation { /** * Get the {@link com.mongodb.client.model.Collation} representation of the {@link Collation}. * - * @return + * @return he native MongoDB representation of the {@link Collation}. */ public com.mongodb.client.model.Collation toMongoCollation() { return map(toMongoCollationConverter()); @@ -390,9 +390,9 @@ public class Collation { /** * Transform {@code this} {@link Collation} by applying a {@link Converter}. * - * @param mapper + * @param mapper must not be {@literal null}. * @param - * @return + * @return the converted result. */ public R map(Converter mapper) { return mapper.convert(this); @@ -771,7 +771,7 @@ public class Collation { * Create new {@link CollationLocale} for given language. * * @param language must not be {@literal null}. - * @return + * @return new instance of {@link CollationLocale}. */ public static CollationLocale of(String language) { @@ -794,7 +794,7 @@ public class Collation { /** * Get the string representation. * - * @return + * @return the collation {@link String} in Mongo ICU format. */ public String asString() { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Criteria.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Criteria.java index 99dcb21e1..364af0093 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Criteria.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Criteria.java @@ -29,7 +29,6 @@ import java.util.stream.Collectors; import org.bson.BsonRegularExpression; import org.bson.Document; import org.bson.types.Binary; - import org.springframework.data.domain.Example; import org.springframework.data.geo.Circle; import org.springframework.data.geo.Point; @@ -105,8 +104,8 @@ public class Criteria implements CriteriaDefinition { /** * Static factory method to create a Criteria using the provided key * - * @param key - * @return + * @param key the property or field name. + * @return new instance of {@link Criteria}. */ public static Criteria where(String key) { return new Criteria(key); @@ -116,7 +115,7 @@ public class Criteria implements CriteriaDefinition { * Static factory method to create a {@link Criteria} matching an example object. * * @param example must not be {@literal null}. - * @return + * @return new instance of {@link Criteria}. * @see Criteria#alike(Example) * @since 1.8 */ @@ -128,7 +127,7 @@ public class Criteria implements CriteriaDefinition { * Static factory method to create a {@link Criteria} matching an example object. * * @param example must not be {@literal null}. - * @return + * @return new instance of {@link Criteria}. * @see Criteria#alike(Example) * @since 1.8 */ @@ -153,7 +152,7 @@ public class Criteria implements CriteriaDefinition { /** * Static factory method to create a Criteria using the provided key * - * @return + * @return new instance of {@link Criteria}. */ public Criteria and(String key) { return new Criteria(this.criteriaChain, key); @@ -162,10 +161,10 @@ public class Criteria implements CriteriaDefinition { /** * Creates a criterion using equality * - * @param o - * @return + * @param value can be {@literal null}. + * @return this. */ - public Criteria is(@Nullable Object o) { + public Criteria is(@Nullable Object value) { if (!isValue.equals(NOT_SET)) { throw new InvalidMongoDbApiUsageException( @@ -176,7 +175,7 @@ public class Criteria implements CriteriaDefinition { throw new InvalidMongoDbApiUsageException("Invalid query: 'not' can't be used with 'is' - use 'ne' instead."); } - this.isValue = o; + this.isValue = value; return this; } @@ -187,120 +186,120 @@ public class Criteria implements CriteriaDefinition { /** * Creates a criterion using the {@literal $ne} operator. * - * @param o - * @return + * @param value can be {@literal null}. + * @return this. * @see MongoDB Query operator: $ne */ - public Criteria ne(@Nullable Object o) { - criteria.put("$ne", o); + public Criteria ne(@Nullable Object value) { + criteria.put("$ne", value); return this; } /** * Creates a criterion using the {@literal $lt} operator. * - * @param o - * @return + * @param value must not be {@literal null}. + * @return this. * @see MongoDB Query operator: $lt */ - public Criteria lt(Object o) { - criteria.put("$lt", o); + public Criteria lt(Object value) { + criteria.put("$lt", value); return this; } /** * Creates a criterion using the {@literal $lte} operator. * - * @param o - * @return + * @param value must not be {@literal null}. + * @return this. * @see MongoDB Query operator: $lte */ - public Criteria lte(Object o) { - criteria.put("$lte", o); + public Criteria lte(Object value) { + criteria.put("$lte", value); return this; } /** * Creates a criterion using the {@literal $gt} operator. * - * @param o - * @return + * @param value must not be {@literal null}. + * @return this. * @see MongoDB Query operator: $gt */ - public Criteria gt(Object o) { - criteria.put("$gt", o); + public Criteria gt(Object value) { + criteria.put("$gt", value); return this; } /** * Creates a criterion using the {@literal $gte} operator. * - * @param o - * @return + * @param value can be {@literal null}. + * @return this. * @see MongoDB Query operator: $gte */ - public Criteria gte(Object o) { - criteria.put("$gte", o); + public Criteria gte(Object value) { + criteria.put("$gte", value); return this; } /** * Creates a criterion using the {@literal $in} operator. * - * @param o the values to match against - * @return + * @param values the values to match against + * @return this. * @see MongoDB Query operator: $in */ - public Criteria in(Object... o) { - if (o.length > 1 && o[1] instanceof Collection) { + public Criteria in(Object... values) { + if (values.length > 1 && values[1] instanceof Collection) { throw new InvalidMongoDbApiUsageException( - "You can only pass in one argument of type " + o[1].getClass().getName()); + "You can only pass in one argument of type " + values[1].getClass().getName()); } - criteria.put("$in", Arrays.asList(o)); + criteria.put("$in", Arrays.asList(values)); return this; } /** * Creates a criterion using the {@literal $in} operator. * - * @param c the collection containing the values to match against - * @return + * @param values the collection containing the values to match against + * @return this. * @see MongoDB Query operator: $in */ - public Criteria in(Collection c) { - criteria.put("$in", c); + public Criteria in(Collection values) { + criteria.put("$in", values); return this; } /** * Creates a criterion using the {@literal $nin} operator. * - * @param o - * @return + * @param values + * @return this. * @see MongoDB Query operator: $nin */ - public Criteria nin(Object... o) { - return nin(Arrays.asList(o)); + public Criteria nin(Object... values) { + return nin(Arrays.asList(values)); } /** * Creates a criterion using the {@literal $nin} operator. * - * @param o - * @return + * @param values must not be {@literal null}. + * @return this. * @see MongoDB Query operator: $nin */ - public Criteria nin(Collection o) { - criteria.put("$nin", o); + public Criteria nin(Collection values) { + criteria.put("$nin", values); return this; } /** * Creates a criterion using the {@literal $mod} operator. * - * @param value - * @param remainder - * @return + * @param value must not be {@literal null}. + * @param remainder must not be {@literal null}. + * @return this. * @see MongoDB Query operator: $mod */ public Criteria mod(Number value, Number remainder) { @@ -314,59 +313,59 @@ public class Criteria implements CriteriaDefinition { /** * Creates a criterion using the {@literal $all} operator. * - * @param o - * @return + * @param values must not be {@literal null}. + * @return this. * @see MongoDB Query operator: $all */ - public Criteria all(Object... o) { - return all(Arrays.asList(o)); + public Criteria all(Object... values) { + return all(Arrays.asList(values)); } /** * Creates a criterion using the {@literal $all} operator. * - * @param o - * @return + * @param values must not be {@literal null}. + * @return this. * @see MongoDB Query operator: $all */ - public Criteria all(Collection o) { - criteria.put("$all", o); + public Criteria all(Collection values) { + criteria.put("$all", values); return this; } /** * Creates a criterion using the {@literal $size} operator. * - * @param s - * @return + * @param size + * @return this. * @see MongoDB Query operator: $size */ - public Criteria size(int s) { - criteria.put("$size", s); + public Criteria size(int size) { + criteria.put("$size", size); return this; } /** * Creates a criterion using the {@literal $exists} operator. * - * @param b - * @return + * @param value + * @return this. * @see MongoDB Query operator: $exists */ - public Criteria exists(boolean b) { - criteria.put("$exists", b); + public Criteria exists(boolean value) { + criteria.put("$exists", value); return this; } /** * Creates a criterion using the {@literal $type} operator. * - * @param t - * @return + * @param typeNumber + * @return this. * @see MongoDB Query operator: $type */ - public Criteria type(int t) { - criteria.put("$type", t); + public Criteria type(int typeNumber) { + criteria.put("$type", typeNumber); return this; } @@ -374,7 +373,7 @@ public class Criteria implements CriteriaDefinition { * Creates a criterion using the {@literal $type} operator. * * @param types must not be {@literal null}. - * @return this + * @return this. * @since 2.1 * @see MongoDB Query operator: $type */ @@ -390,7 +389,7 @@ public class Criteria implements CriteriaDefinition { /** * Creates a criterion using the {@literal $not} meta operator which affects the clause directly following * - * @return + * @return this. * @see MongoDB Query operator: $not */ public Criteria not() { @@ -400,8 +399,8 @@ public class Criteria implements CriteriaDefinition { /** * Creates a criterion using the {@literal $not} operator. * - * @param value - * @return + * @param value can be {@literal null}. + * @return this. * @see MongoDB Query operator: $not */ private Criteria not(@Nullable Object value) { @@ -412,31 +411,31 @@ public class Criteria implements CriteriaDefinition { /** * Creates a criterion using a {@literal $regex} operator. * - * @param re - * @return + * @param regex must not be {@literal null}. + * @return this. * @see MongoDB Query operator: $regex */ - public Criteria regex(String re) { - return regex(re, null); + public Criteria regex(String regex) { + return regex(regex, null); } /** * Creates a criterion using a {@literal $regex} and {@literal $options} operator. * - * @param re - * @param options - * @return + * @param regex must not be {@literal null}. + * @param options can be {@literal null}. + * @return this. * @see MongoDB Query operator: $regex */ - public Criteria regex(String re, @Nullable String options) { - return regex(toPattern(re, options)); + public Criteria regex(String regex, @Nullable String options) { + return regex(toPattern(regex, options)); } /** * Syntactical sugar for {@link #is(Object)} making obvious that we create a regex predicate. * - * @param pattern - * @return + * @param pattern must not be {@literal null}. + * @return this. */ public Criteria regex(Pattern pattern) { @@ -450,6 +449,12 @@ public class Criteria implements CriteriaDefinition { return this; } + /** + * Use a MongoDB native {@link BsonRegularExpression}. + * + * @param regex must not be {@literal null}. + * @return this. + */ public Criteria regex(BsonRegularExpression regex) { if (lastOperatorWasNot()) { @@ -472,7 +477,7 @@ public class Criteria implements CriteriaDefinition { * Mongo 2.4 and higher. * * @param circle must not be {@literal null} - * @return + * @return this. * @see MongoDB Query operator: * $geoWithin * @see MongoDB Query operator: @@ -489,8 +494,8 @@ public class Criteria implements CriteriaDefinition { /** * Creates a geospatial criterion using a {@literal $geoWithin} operation. * - * @param shape - * @return + * @param shape must not be {@literal null}. + * @return this. * @see MongoDB Query operator: * $geoWithin */ @@ -506,7 +511,7 @@ public class Criteria implements CriteriaDefinition { * Creates a geospatial criterion using a {@literal $near} operation. * * @param point must not be {@literal null} - * @return + * @return this. * @see MongoDB Query operator: $near */ public Criteria near(Point point) { @@ -522,7 +527,7 @@ public class Criteria implements CriteriaDefinition { * higher. * * @param point must not be {@literal null} - * @return + * @return this. * @see MongoDB Query operator: * $nearSphere */ @@ -539,7 +544,7 @@ public class Criteria implements CriteriaDefinition { * structure and the documents one. Requires MongoDB 2.4 or better. * * @param geoJson must not be {@literal null}. - * @return + * @return this. * @since 1.8 */ @SuppressWarnings("rawtypes") @@ -554,7 +559,7 @@ public class Criteria implements CriteriaDefinition { * Creates a geo-spatial criterion using a {@literal $maxDistance} operation, for use with $near * * @param maxDistance - * @return + * @return this. * @see MongoDB Query operator: * $maxDistance */ @@ -574,7 +579,7 @@ public class Criteria implements CriteriaDefinition { * {@literal $nearSphere}. * * @param minDistance - * @return + * @return this. * @since 1.7 */ public Criteria minDistance(double minDistance) { @@ -591,21 +596,21 @@ public class Criteria implements CriteriaDefinition { /** * Creates a criterion using the {@literal $elemMatch} operator * - * @param c - * @return + * @param criteria must not be {@literal null}. + * @return this. * @see MongoDB Query operator: * $elemMatch */ - public Criteria elemMatch(Criteria c) { - criteria.put("$elemMatch", c.getCriteriaObject()); + public Criteria elemMatch(Criteria criteria) { + this.criteria.put("$elemMatch", criteria.getCriteriaObject()); return this; } /** * Creates a criterion using the given object as a pattern. * - * @param sample - * @return + * @param sample must not be {@literal null}. + * @return this. * @since 1.8 */ public Criteria alike(Example sample) { @@ -657,7 +662,8 @@ public class Criteria implements CriteriaDefinition { *

* * @throws IllegalArgumentException if {@link #orOperator(Criteria...)} follows a not() call directly. - * @param criteria + * @param criteria must not be {@literal null}. + * @return this. */ public Criteria orOperator(Criteria... criteria) { BasicDBList bsonList = createCriteriaList(criteria); @@ -671,7 +677,8 @@ public class Criteria implements CriteriaDefinition { *

* * @throws IllegalArgumentException if {@link #norOperator(Criteria...)} follows a not() call directly. - * @param criteria + * @param criteria must not be {@literal null}. + * @return this. */ public Criteria norOperator(Criteria... criteria) { BasicDBList bsonList = createCriteriaList(criteria); @@ -685,7 +692,8 @@ public class Criteria implements CriteriaDefinition { *

* * @throws IllegalArgumentException if {@link #andOperator(Criteria...)} follows a not() call directly. - * @param criteria + * @param criteria must not be {@literal null}. + * @return this. */ public Criteria andOperator(Criteria... criteria) { BasicDBList bsonList = createCriteriaList(criteria); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/GeoCommand.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/GeoCommand.java index b18e7831e..5217fb756 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/GeoCommand.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/GeoCommand.java @@ -67,7 +67,8 @@ public final class GeoCommand { * Returns the MongoDB command for the given {@link Shape}. * * @param shape must not be {@literal null}. - * @return + * @return never {@literal null}. + * @throws IllegalArgumentException for unknown {@link Shape}. */ private String getCommand(Shape shape) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java index 154d5de59..291af0c65 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Query.java @@ -67,7 +67,7 @@ public class Query { * Static factory method to create a {@link Query} using the provided {@link CriteriaDefinition}. * * @param criteriaDefinition must not be {@literal null}. - * @return + * @return new instance of {@link Query}. * @since 1.6 */ public static Query query(CriteriaDefinition criteriaDefinition) { @@ -90,7 +90,7 @@ public class Query { * Adds the given {@link CriteriaDefinition} to the current {@link Query}. * * @param criteriaDefinition must not be {@literal null}. - * @return + * @return this. * @since 1.6 */ public Query addCriteria(CriteriaDefinition criteriaDefinition) { @@ -124,7 +124,7 @@ public class Query { * Set number of documents to skip before returning results. * * @param skip - * @return + * @return this. */ public Query skip(long skip) { this.skip = skip; @@ -135,7 +135,7 @@ public class Query { * Limit the number of returned documents to {@code limit}. * * @param limit - * @return + * @return this. */ public Query limit(int limit) { this.limit = limit; @@ -147,7 +147,7 @@ public class Query { * json {@link Document} representation. * * @param hint must not be {@literal null} or empty. - * @return + * @return this. * @see Document#parse(String) */ public Query withHint(String hint) { @@ -161,7 +161,7 @@ public class Query { * Configures the query to use the given {@link Document hint} when being executed. * * @param hint must not be {@literal null}. - * @return + * @return this. * @since 2.2 */ public Query withHint(Document hint) { @@ -175,8 +175,8 @@ public class Query { * Sets the given pagination information on the {@link Query} instance. Will transparently set {@code skip} and * {@code limit} as well as applying the {@link Sort} instance defined with the {@link Pageable}. * - * @param pageable - * @return + * @param pageable must not be {@literal null}. + * @return this. */ public Query with(Pageable pageable) { @@ -193,8 +193,8 @@ public class Query { /** * Adds a {@link Sort} to the {@link Query} instance. * - * @param sort - * @return + * @param sort must not be {@literal null}. + * @return this. */ public Query with(Sort sort) { @@ -227,7 +227,7 @@ public class Query { * * @param type may not be {@literal null} * @param additionalTypes may not be {@literal null} - * @return + * @return this. */ public Query restrict(Class type, Class... additionalTypes) { @@ -296,7 +296,7 @@ public class Query { /** * Get the number of documents to skip. * - * @return + * @return number of documents to skip */ public long getSkip() { return this.skip; @@ -305,14 +305,14 @@ public class Query { /** * Get the maximum number of documents to be return. * - * @return + * @return number of documents to return. */ public int getLimit() { return this.limit; } /** - * @return + * @return can be {@literal null}. */ @Nullable public String getHint() { @@ -333,7 +333,7 @@ public class Query { /** * @param timeout - * @param timeUnit + * @param timeUnit must not be {@literal null}. * @return this. * @see Meta#setMaxTime(long, TimeUnit) * @since 1.6 @@ -347,7 +347,7 @@ public class Query { } /** - * @param timeout + * @param timeout must not be {@literal null}. * @return this. * @see Meta#setMaxTime(Duration) * @since 2.1 @@ -361,7 +361,7 @@ public class Query { /** * Add a comment to the query that is propagated to the profile log. * - * @param comment + * @param comment must not be {@literal null}. * @return this. * @see Meta#setComment(String) * @since 1.6 @@ -456,7 +456,7 @@ public class Query { * Set the {@link Collation} applying language-specific rules for string comparison. * * @param collation can be {@literal null}. - * @return + * @return this. * @since 2.0 */ public Query collation(@Nullable Collation collation) { @@ -468,7 +468,7 @@ public class Query { /** * Get the {@link Collation} defining language-specific rules for string comparison. * - * @return + * @return never {@literal null}. * @since 2.0 */ public Optional getCollation() { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/TextQuery.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/TextQuery.java index 0f1e40550..0560b5d38 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/TextQuery.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/TextQuery.java @@ -65,8 +65,8 @@ public class TextQuery extends Query { * For a full list of supported languages see the mongdodb reference manual for * Text Search Languages. * - * @param wordsAndPhrases - * @param locale + * @param wordsAndPhrases must not be {@literal null}. + * @param locale can be {@literal null}. */ public TextQuery(String wordsAndPhrases, @Nullable Locale locale) { this(wordsAndPhrases, locale != null ? locale.getLanguage() : (String) null); @@ -75,7 +75,7 @@ public class TextQuery extends Query { /** * Creates new {@link TextQuery} for given {@link TextCriteria}. * - * @param criteria. + * @param criteria must not be {@literal null}. */ public TextQuery(TextCriteria criteria) { super(criteria); @@ -84,8 +84,8 @@ public class TextQuery extends Query { /** * Creates new {@link TextQuery} searching for given {@link TextCriteria}. * - * @param criteria - * @return + * @param criteria must not be {@literal null}. + * @return new instance of {@link TextQuery}. */ public static TextQuery queryText(TextCriteria criteria) { return new TextQuery(criteria); @@ -95,7 +95,7 @@ public class TextQuery extends Query { * Add sorting by text score. Will also add text score to returned fields. * * @see TextQuery#includeScore() - * @return + * @return this. */ public TextQuery sortByScore() { @@ -107,7 +107,7 @@ public class TextQuery extends Query { /** * Add field {@literal score} holding the documents textScore to the returned fields. * - * @return + * @return this. */ public TextQuery includeScore() { @@ -118,8 +118,8 @@ public class TextQuery extends Query { /** * Include text search document score in returned fields using the given fieldname. * - * @param fieldname - * @return + * @param fieldname must not be {@literal null}. + * @return this. */ public TextQuery includeScore(String fieldname) { @@ -131,7 +131,7 @@ public class TextQuery extends Query { /** * Set the fieldname used for scoring. * - * @param fieldName + * @param fieldName must not be {@literal null}. */ public void setScoreFieldName(String fieldName) { this.scoreFieldName = fieldName; @@ -140,7 +140,7 @@ public class TextQuery extends Query { /** * Get the fieldname used for scoring * - * @return + * @return never {@literal null}. */ public String getScoreFieldName() { return scoreFieldName; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Update.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Update.java index edb79588d..cf2d14efd 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Update.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query/Update.java @@ -64,8 +64,8 @@ public class Update implements UpdateDefinition { /** * Static factory method to create an Update using the provided key * - * @param key - * @return + * @param key the field to update. + * @return new instance of {@link Update}. */ public static Update update(String key, @Nullable Object value) { return new Update().set(key, value); @@ -80,7 +80,7 @@ public class Update implements UpdateDefinition { * * @param object the source {@link Document} to create the update from. * @param exclude the fields to exclude. - * @return + * @return new instance of {@link Update}. */ public static Update fromDocument(Document object, String... exclude) { @@ -108,7 +108,7 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $set} update modifier * - * @param key + * @param key the field name. * @param value can be {@literal null}. In this case the property remains in the db with a {@literal null} value. To * remove it use {@link #unset(String)}. * @return this. @@ -122,9 +122,9 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $setOnInsert} update modifier * - * @param key + * @param key the field name. * @param value can be {@literal null}. - * @return + * @return this. * @see MongoDB Update operator: * $setOnInsert */ @@ -136,8 +136,8 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $unset} update modifier * - * @param key - * @return + * @param key the field name. + * @return this. * @see MongoDB Update operator: $unset */ public Update unset(String key) { @@ -148,9 +148,9 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $inc} update modifier * - * @param key - * @param inc - * @return + * @param key the field name. + * @param inc must not be {@literal null}. + * @return this. * @see MongoDB Update operator: $inc */ public Update inc(String key, Number inc) { @@ -170,9 +170,9 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $push} update modifier * - * @param key - * @param value - * @return + * @param key the field name. + * @param value can be {@literal null}. + * @return this. * @see MongoDB Update operator: $push */ public Update push(String key, @Nullable Object value) { @@ -185,7 +185,7 @@ public class Update implements UpdateDefinition { * Allows creation of {@code $push} command for single or multiple (using {@code $each}) values as well as using * {@code $position}. * - * @param key + * @param key the field name. * @return {@link PushOperatorBuilder} for given key * @see MongoDB Update operator: $push * @see MongoDB Update operator: $each @@ -204,9 +204,9 @@ public class Update implements UpdateDefinition { * Important: As of MongoDB 3.6 {@code $pushAll} is not longer supported. Use {@code $push $each} instead. * {@link #push(String)}) returns a builder that can be used to populate the {@code $each} object. * - * @param key - * @param values - * @return + * @param key the field name. + * @param values must not be {@literal null}. + * @return this. * @see MongoDB Update operator: * $pushAll * @deprecated as of MongoDB 2.4. Removed in MongoDB 3.6. Use {@link #push(String) $push $each} instead. @@ -221,8 +221,8 @@ public class Update implements UpdateDefinition { * Update using {@code $addToSet} modifier.
* Allows creation of {@code $push} command for single or multiple (using {@code $each}) values * - * @param key - * @return + * @param key the field name. + * @return new instance of {@link AddToSetBuilder}. * @since 1.5 */ public AddToSetBuilder addToSet(String key) { @@ -232,9 +232,9 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $addToSet} update modifier * - * @param key - * @param value - * @return + * @param key the field name. + * @param value can be {@literal null}. + * @return this. * @see MongoDB Update operator: * $addToSet */ @@ -246,9 +246,9 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $pop} update modifier * - * @param key - * @param pos - * @return + * @param key the field name. + * @param pos must not be {@literal null}. + * @return this. * @see MongoDB Update operator: $pop */ public Update pop(String key, Position pos) { @@ -259,9 +259,9 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $pull} update modifier * - * @param key - * @param value - * @return + * @param key the field name. + * @param value can be {@literal null}. + * @return this. * @see MongoDB Update operator: $pull */ public Update pull(String key, @Nullable Object value) { @@ -272,9 +272,9 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $pullAll} update modifier * - * @param key - * @param values - * @return + * @param key the field name. + * @param values must not be {@literal null}. + * @return this. * @see MongoDB Update operator: * $pullAll */ @@ -286,9 +286,9 @@ public class Update implements UpdateDefinition { /** * Update using the {@literal $rename} update modifier * - * @param oldName - * @param newName - * @return + * @param oldName must not be {@literal null}. + * @param newName must not be {@literal null}. + * @return this. * @see MongoDB Update operator: * $rename */ @@ -300,8 +300,8 @@ public class Update implements UpdateDefinition { /** * Update given key to current date using {@literal $currentDate} modifier. * - * @param key - * @return + * @param key the field name. + * @return this. * @since 1.6 * @see MongoDB Update operator: * $currentDate @@ -315,8 +315,8 @@ public class Update implements UpdateDefinition { /** * Update given key to current date using {@literal $currentDate : { $type : "timestamp" }} modifier. * - * @param key - * @return + * @param key the field name. + * @return this. * @since 1.6 * @see MongoDB Update operator: * $currentDate @@ -332,7 +332,7 @@ public class Update implements UpdateDefinition { * * @param key must not be {@literal null}. * @param multiplier must not be {@literal null}. - * @return + * @return this. * @since 1.7 * @see MongoDB Update operator: $mul */ @@ -348,7 +348,7 @@ public class Update implements UpdateDefinition { * * @param key must not be {@literal null}. * @param value must not be {@literal null}. - * @return + * @return this. * @since 1.10 * @see Comparison/Sort Order * @see MongoDB Update operator: $max @@ -365,7 +365,7 @@ public class Update implements UpdateDefinition { * * @param key must not be {@literal null}. * @param value must not be {@literal null}. - * @return + * @return this. * @since 1.10 * @see Comparison/Sort Order * @see MongoDB Update operator: $min @@ -380,8 +380,8 @@ public class Update implements UpdateDefinition { /** * The operator supports bitwise {@code and}, bitwise {@code or}, and bitwise {@code xor} operations. * - * @param key - * @return + * @param key the field name. + * @return this. * @since 1.7 */ public BitwiseOperatorBuilder bitwise(String key) { @@ -391,9 +391,9 @@ public class Update implements UpdateDefinition { /** * Prevents a write operation that affects multiple documents from yielding to other reads or writes * once the first document is written.
- * Use with {@link org.springframework.data.mongodb.core.MongoOperations#updateMulti(Query, Update, Class)}. + * Use with {@link org.springframework.data.mongodb.core.MongoOperations#updateMulti(Query, UpdateDefinition, Class)}. * - * @return never {@literal null}. + * @return this. * @since 2.0 */ public Update isolated() { @@ -497,8 +497,8 @@ public class Update implements UpdateDefinition { /** * Determine if a given {@code key} will be touched on execution. * - * @param key - * @return + * @param key the field name. + * @return {@literal true} if given field is updated. */ public boolean modifies(String key) { return this.keysToUpdate.contains(key); @@ -507,8 +507,8 @@ public class Update implements UpdateDefinition { /** * Inspects given {@code key} for '$'. * - * @param key - * @return + * @param key the field name. + * @return {@literal true} if given key is prefixed. */ private static boolean isKeyword(String key) { return StringUtils.startsWithIgnoreCase(key, "$"); @@ -1046,8 +1046,8 @@ public class Update implements UpdateDefinition { /** * Propagates {@code $each} to {@code $addToSet} * - * @param values - * @return + * @param values must not be {@literal null}. + * @return never {@literal null}. */ public Update each(Object... values) { return Update.this.addToSet(this.key, new Each(values)); @@ -1056,8 +1056,8 @@ public class Update implements UpdateDefinition { /** * Propagates {@link #value(Object)} to {@code $addToSet} * - * @param values - * @return + * @param value + * @return never {@literal null}. */ public Update value(Object value) { return Update.this.addToSet(this.key, value); @@ -1102,7 +1102,7 @@ public class Update implements UpdateDefinition { * Updates to the result of a bitwise and operation between the current value and the given one. * * @param value - * @return + * @return never {@literal null}. */ public Update and(long value) { @@ -1114,7 +1114,7 @@ public class Update implements UpdateDefinition { * Updates to the result of a bitwise or operation between the current value and the given one. * * @param value - * @return + * @return never {@literal null}. */ public Update or(long value) { @@ -1126,7 +1126,7 @@ public class Update implements UpdateDefinition { * Updates to the result of a bitwise xor operation between the current value and the given one. * * @param value - * @return + * @return never {@literal null}. */ public Update xor(long value) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/IdentifiableJsonSchemaProperty.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/IdentifiableJsonSchemaProperty.java index ef6d0f639..d87247f61 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/IdentifiableJsonSchemaProperty.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/IdentifiableJsonSchemaProperty.java @@ -365,7 +365,6 @@ public class IdentifiableJsonSchemaProperty implemen /** * @param range must not be {@literal null}. * @return new instance of {@link ObjectJsonSchemaProperty}. - * @see ObjectJsonSchemaObject#propertiesCount */ public ObjectJsonSchemaProperty propertiesCount(Range range) { return new ObjectJsonSchemaProperty(identifier, jsonSchemaObjectDelegate.propertiesCount(range)); @@ -1120,16 +1119,16 @@ public class IdentifiableJsonSchemaProperty implemen } /** - * @param key - * @return + * @param keyId must not be {@literal null}. + * @return new instance of {@link EncryptedJsonSchemaProperty}. */ public EncryptedJsonSchemaProperty keyId(String keyId) { return new EncryptedJsonSchemaProperty(targetProperty, algorithm, keyId, null); } /** - * @param keyId - * @return + * @param keyId must not be {@literal null}. + * @return new instance of {@link EncryptedJsonSchemaProperty}. */ public EncryptedJsonSchemaProperty keys(UUID... keyId) { return new EncryptedJsonSchemaProperty(targetProperty, algorithm, null, Arrays.asList(keyId)); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/JsonSchemaProperty.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/JsonSchemaProperty.java index d13752820..3d3c2f459 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/JsonSchemaProperty.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/JsonSchemaProperty.java @@ -218,8 +218,8 @@ public interface JsonSchemaProperty extends JsonSchemaObject { /** * Obtain a builder to create a {@link JsonSchemaProperty}. * - * @param identifier - * @return + * @param identifier must not be {@literal null}. + * @return new instance of {@link JsonSchemaPropertyBuilder}. */ static JsonSchemaPropertyBuilder named(String identifier) { return new JsonSchemaPropertyBuilder(identifier); @@ -248,7 +248,7 @@ public interface JsonSchemaProperty extends JsonSchemaObject { * Configure a {@link Type} for the property. * * @param type must not be {@literal null}. - * @return + * @return new instance of {@link IdentifiableJsonSchemaProperty}. */ public IdentifiableJsonSchemaProperty ofType(Type type) { return new IdentifiableJsonSchemaProperty<>(identifier, TypedJsonSchemaObject.of(type)); @@ -269,7 +269,7 @@ public interface JsonSchemaProperty extends JsonSchemaObject { * Configure a {@link TypedJsonSchemaObject} for the property. * * @param schemaObject must not be {@literal null}. - * @return + * @return new instance of {@link IdentifiableJsonSchemaProperty}. */ public IdentifiableJsonSchemaProperty with(TypedJsonSchemaObject schemaObject) { return new IdentifiableJsonSchemaProperty<>(identifier, schemaObject); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/MongoJsonSchema.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/MongoJsonSchema.java index b60c52cd2..ea7bf542e 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/MongoJsonSchema.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/MongoJsonSchema.java @@ -74,7 +74,7 @@ public interface MongoJsonSchema { * Create a new {@link MongoJsonSchema} for a given root object. * * @param root must not be {@literal null}. - * @return + * @return new instance of {@link MongoJsonSchema}. */ static MongoJsonSchema of(JsonSchemaObject root) { return new DefaultMongoJsonSchema(root); @@ -84,7 +84,7 @@ public interface MongoJsonSchema { * Create a new {@link MongoJsonSchema} for a given root {@link Document} containing the schema definition. * * @param document must not be {@literal null}. - * @return + * @return new instance of {@link MongoJsonSchema}. */ static MongoJsonSchema of(Document document) { return new DocumentJsonSchema(document); @@ -135,7 +135,7 @@ public interface MongoJsonSchema { } /** - * @param properties + * @param properties must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see ObjectJsonSchemaObject#required(String...) */ @@ -157,7 +157,7 @@ public interface MongoJsonSchema { } /** - * @param schema + * @param schema must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see ObjectJsonSchemaObject#additionalProperties(ObjectJsonSchemaObject) */ @@ -168,7 +168,7 @@ public interface MongoJsonSchema { } /** - * @param properties + * @param properties must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see ObjectJsonSchemaObject#properties(JsonSchemaProperty...) */ @@ -179,7 +179,7 @@ public interface MongoJsonSchema { } /** - * @param properties + * @param properties must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see ObjectJsonSchemaObject#patternProperties(JsonSchemaProperty...) */ @@ -190,7 +190,7 @@ public interface MongoJsonSchema { } /** - * @param property + * @param property must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see ObjectJsonSchemaObject#property(JsonSchemaProperty) */ @@ -201,7 +201,7 @@ public interface MongoJsonSchema { } /** - * @param possibleValues + * @param possibleValues must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see ObjectJsonSchemaObject#possibleValues(Collection) */ @@ -212,7 +212,7 @@ public interface MongoJsonSchema { } /** - * @param allOf + * @param allOf must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see UntypedJsonSchemaObject#allOf(Collection) */ @@ -223,7 +223,7 @@ public interface MongoJsonSchema { } /** - * @param anyOf + * @param anyOf must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see UntypedJsonSchemaObject#anyOf(Collection) */ @@ -234,7 +234,7 @@ public interface MongoJsonSchema { } /** - * @param oneOf + * @param oneOf must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see UntypedJsonSchemaObject#oneOf(Collection) */ @@ -245,7 +245,7 @@ public interface MongoJsonSchema { } /** - * @param notMatch + * @param notMatch must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see UntypedJsonSchemaObject#notMatch(JsonSchemaObject) */ @@ -256,7 +256,7 @@ public interface MongoJsonSchema { } /** - * @param description + * @param description must not be {@literal null}. * @return {@code this} {@link MongoJsonSchemaBuilder}. * @see UntypedJsonSchemaObject#description(String) */ diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/TypedJsonSchemaObject.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/TypedJsonSchemaObject.java index fe1e13ab3..a481c53c7 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/TypedJsonSchemaObject.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/TypedJsonSchemaObject.java @@ -111,7 +111,6 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject { /** * Auto generate the {@literal description} if not explicitly set. * - * @param description must not be {@literal null}. * @return new instance of {@link TypedJsonSchemaObject}. */ @Override @@ -167,7 +166,7 @@ public class TypedJsonSchemaObject extends UntypedJsonSchemaObject { /** * The field value must not match the specified schemas. * - * @param oneOf must not be {@literal null}. + * @param notMatch must not be {@literal null}. * @return new instance of {@link TypedJsonSchemaObject}. */ @Override diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/UntypedJsonSchemaObject.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/UntypedJsonSchemaObject.java index e3d05d419..d1f695428 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/UntypedJsonSchemaObject.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/schema/UntypedJsonSchemaObject.java @@ -132,7 +132,7 @@ public class UntypedJsonSchemaObject implements JsonSchemaObject { /** * The field value must not match the specified schemas. * - * @param oneOf must not be {@literal null}. + * @param notMatch must not be {@literal null}. * @return new instance of {@link TypedJsonSchemaObject}. */ public UntypedJsonSchemaObject notMatch(JsonSchemaObject notMatch) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsCriteria.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsCriteria.java index 27a337ff4..712c816ef 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsCriteria.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsCriteria.java @@ -29,7 +29,7 @@ public class GridFsCriteria extends Criteria { /** * Creates a new {@link GridFsCriteria} for the given key. * - * @param key + * @param key must not be {@literal null}. */ public GridFsCriteria(String key) { super(key); @@ -38,7 +38,7 @@ public class GridFsCriteria extends Criteria { /** * Creates a {@link GridFsCriteria} for restrictions on the file's metadata. * - * @return + * @return new instance of {@link GridFsCriteria}. */ public static GridFsCriteria whereMetaData() { return new GridFsCriteria("metadata"); @@ -47,8 +47,8 @@ public class GridFsCriteria extends Criteria { /** * Creates a {@link GridFsCriteria} for restrictions on a single file's metadata item. * - * @param metadataKey - * @return + * @param metadataKey can be {@literal null}. + * @return new instance of {@link GridFsCriteria}. */ public static GridFsCriteria whereMetaData(@Nullable String metadataKey) { @@ -59,7 +59,7 @@ public class GridFsCriteria extends Criteria { /** * Creates a {@link GridFsCriteria} for restrictions on the file's name. * - * @return + * @return new instance of {@link GridFsCriteria}. */ public static GridFsCriteria whereFilename() { return new GridFsCriteria("filename"); @@ -68,7 +68,7 @@ public class GridFsCriteria extends Criteria { /** * Creates a {@link GridFsCriteria} for restrictions on the file's content type. * - * @return + * @return new instance of {@link GridFsCriteria}. */ public static GridFsCriteria whereContentType() { return new GridFsCriteria("metadata.".concat(GridFsResource.CONTENT_TYPE_FIELD)); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsOperations.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsOperations.java index 036666857..502d21098 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsOperations.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsOperations.java @@ -179,7 +179,7 @@ public interface GridFsOperations extends ResourcePatternResolver { * case no file matches. * * @param query must not be {@literal null}. - * @return + * @return can be {@literal null}. */ @Nullable com.mongodb.client.gridfs.model.GridFSFile findOne(Query query); @@ -214,7 +214,7 @@ public interface GridFsOperations extends ResourcePatternResolver { * Returns all {@link GridFsResource}s matching the given file name pattern. * * @param filenamePattern must not be {@literal null}. - * @return + * @return an empty array if none found. * @see ResourcePatternResolver#getResources(String) */ GridFsResource[] getResources(String filenamePattern); diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java index 45702ef24..57b8b7df8 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsTemplate.java @@ -75,7 +75,7 @@ public class GridFsTemplate extends GridFsOperationsSupport implements GridFsOpe * * @param dbFactory must not be {@literal null}. * @param converter must not be {@literal null}. - * @param bucket + * @param bucket can be {@literal null}. */ public GridFsTemplate(MongoDatabaseFactory dbFactory, MongoConverter converter, @Nullable String bucket) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsUpload.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsUpload.java index c86926db7..3d2405759 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsUpload.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/gridfs/GridFsUpload.java @@ -188,7 +188,7 @@ public class GridFsUpload implements GridFsObject { * Set the file metadata. * * @param metadata must not be {@literal null}. - * @return + * @return this. */ public GridFsUploadBuilder metadata(Document metadata) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AbstractMonitor.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AbstractMonitor.java index 94dcac336..e9c1b00b7 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AbstractMonitor.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AbstractMonitor.java @@ -37,7 +37,7 @@ public abstract class AbstractMonitor { private final MongoClient mongoClient; /** - * @param mongoClient + * @param mongoClient must not be {@literal null}. * @since 2.2 */ protected AbstractMonitor(MongoClient mongoClient) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AssertMetrics.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AssertMetrics.java index 7bf4b9b55..220bcadd3 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AssertMetrics.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/AssertMetrics.java @@ -31,7 +31,7 @@ import com.mongodb.client.MongoClient; public class AssertMetrics extends AbstractMonitor { /** - * @param mongoClient + * @param mongoClient must not be {@literal null}. * @since 2.2 */ public AssertMetrics(MongoClient mongoClient) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/BackgroundFlushingMetrics.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/BackgroundFlushingMetrics.java index b56fdf769..9a502cb74 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/BackgroundFlushingMetrics.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/BackgroundFlushingMetrics.java @@ -33,7 +33,7 @@ import com.mongodb.client.MongoClient; public class BackgroundFlushingMetrics extends AbstractMonitor { /** - * @param mongoClient + * @param mongoClient must not be {@literal null}. * @since 2.2 */ public BackgroundFlushingMetrics(MongoClient mongoClient) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/BtreeIndexCounters.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/BtreeIndexCounters.java index 2afec53f2..d7480a6e1 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/BtreeIndexCounters.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/BtreeIndexCounters.java @@ -31,7 +31,7 @@ import com.mongodb.client.MongoClient; public class BtreeIndexCounters extends AbstractMonitor { /** - * @param mongoClient + * @param mongoClient must not be {@literal null}. * @since 2.2 */ public BtreeIndexCounters(MongoClient mongoClient) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/ConnectionMetrics.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/ConnectionMetrics.java index a4b428e01..ae453fd1d 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/ConnectionMetrics.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/ConnectionMetrics.java @@ -31,7 +31,7 @@ import com.mongodb.client.MongoClient; public class ConnectionMetrics extends AbstractMonitor { /** - * @param mongoClient + * @param mongoClient must not be {@literal null}. * @since 2.2 */ public ConnectionMetrics(MongoClient mongoClient) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/GlobalLockMetrics.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/GlobalLockMetrics.java index 23f881399..eb2f0d6af 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/GlobalLockMetrics.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/monitor/GlobalLockMetrics.java @@ -32,7 +32,7 @@ import com.mongodb.client.MongoClient; public class GlobalLockMetrics extends AbstractMonitor { /** - * @param mongoClient + * @param mongoClient must not be {@literal null}. * @since 2.2 */ public GlobalLockMetrics(MongoClient mongoClient) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/CountQuery.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/CountQuery.java index 8c0d5c25c..36eb77397 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/CountQuery.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/CountQuery.java @@ -41,7 +41,7 @@ public @interface CountQuery { * Takes a MongoDB JSON string to define the actual query to be executed. This one will take precedence over the * method name then. Alias for {@link Query#value}. * - * @return + * @return an empty String by default. */ @AliasFor(annotation = Query.class) String value() default ""; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/DeleteQuery.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/DeleteQuery.java index c41ee5ba9..598941b99 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/DeleteQuery.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/DeleteQuery.java @@ -41,7 +41,7 @@ public @interface DeleteQuery { * Takes a MongoDB JSON string to define the actual query to be executed. This one will take precedence over the * method name then. Alias for {@link Query#value}. * - * @return + * @return empty {@link String} by default. */ @AliasFor(annotation = Query.class) String value() default ""; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/ExistsQuery.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/ExistsQuery.java index 73fcabb4a..04b3c0225 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/ExistsQuery.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/ExistsQuery.java @@ -40,7 +40,7 @@ public @interface ExistsQuery { * Takes a MongoDB JSON string to define the actual query to be executed. This one will take precedence over the * method name then. Alias for {@link Query#value}. * - * @return + * @return empty {@link String} by default. */ @AliasFor(annotation = Query.class) String value() default ""; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java index 929e3a63e..50288a1f7 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/Meta.java @@ -37,7 +37,7 @@ public @interface Meta { /** * Set the maximum time limit in milliseconds for processing operations. * - * @return + * @return {@literal -1} by default. * @since 1.10 */ long maxExecutionTimeMs() default -1; @@ -55,7 +55,7 @@ public @interface Meta { /** * Add a comment to the query. * - * @return + * @return empty {@link String} by default. */ String comment() default ""; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/MongoRepository.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/MongoRepository.java index 664c5ca8b..88f7d11f7 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/MongoRepository.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/MongoRepository.java @@ -69,7 +69,7 @@ public interface MongoRepository extends PagingAndSortingRepository * * - * @return + * @return empty {@link String} by default. * @since 2.1 */ String sort() default ""; diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/config/EnableMongoRepositories.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/config/EnableMongoRepositories.java index dced7913c..7b6ed5bdb 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/config/EnableMongoRepositories.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/config/EnableMongoRepositories.java @@ -47,7 +47,8 @@ public @interface EnableMongoRepositories { /** * Alias for the {@link #basePackages()} attribute. Allows for more concise annotation declarations e.g.: - * {@code @EnableMongoRepositories("org.my.pkg")} instead of {@code @EnableMongoRepositories(basePackages="org.my.pkg")}. + * {@code @EnableMongoRepositories("org.my.pkg")} instead of + * {@code @EnableMongoRepositories(basePackages="org.my.pkg")}. */ String[] value() default {}; @@ -80,7 +81,7 @@ public @interface EnableMongoRepositories { * for a repository named {@code PersonRepository} the corresponding implementation class will be looked up scanning * for {@code PersonRepositoryImpl}. * - * @return + * @return {@literal Impl} by default. */ String repositoryImplementationPostfix() default "Impl"; @@ -88,7 +89,7 @@ public @interface EnableMongoRepositories { * Configures the location of where to find the Spring Data named queries properties file. Will default to * {@code META-INFO/mongo-named-queries.properties}. * - * @return + * @return empty {@link String} by default. */ String namedQueriesLocation() default ""; @@ -96,7 +97,7 @@ public @interface EnableMongoRepositories { * Returns the key of the {@link QueryLookupStrategy} to be used for lookup queries for query methods. Defaults to * {@link Key#CREATE_IF_NOT_FOUND}. * - * @return + * @return {@link Key#CREATE_IF_NOT_FOUND} by default. */ Key queryLookupStrategy() default Key.CREATE_IF_NOT_FOUND; @@ -104,14 +105,14 @@ public @interface EnableMongoRepositories { * Returns the {@link FactoryBean} class to be used for each repository instance. Defaults to * {@link MongoRepositoryFactoryBean}. * - * @return + * @return {@link MongoRepositoryFactoryBean} by default. */ Class repositoryFactoryBeanClass() default MongoRepositoryFactoryBean.class; /** * Configure the repository base class to be used to create repository proxies for this particular configuration. * - * @return + * @return {@link DefaultRepositoryBaseClass} by default. * @since 1.8 */ Class repositoryBaseClass() default DefaultRepositoryBaseClass.class; @@ -119,20 +120,22 @@ public @interface EnableMongoRepositories { /** * Configures the name of the {@link MongoTemplate} bean to be used with the repositories detected. * - * @return + * @return {@literal mongoTemplate} by default. */ String mongoTemplateRef() default "mongoTemplate"; /** * Whether to automatically create indexes for query methods defined in the repository interface. * - * @return + * @return {@literal false} by default. */ boolean createIndexesForQueryMethods() default false; /** * Configures whether nested repository-interfaces (e.g. defined as inner classes) should be discovered by the * repositories infrastructure. + * + * @return {@literal false} by default. */ boolean considerNestedRepositories() default false; } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/config/EnableReactiveMongoRepositories.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/config/EnableReactiveMongoRepositories.java index 5ba8dcf8e..7b0d54021 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/config/EnableReactiveMongoRepositories.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/config/EnableReactiveMongoRepositories.java @@ -84,7 +84,7 @@ public @interface EnableReactiveMongoRepositories { * for a repository named {@code PersonRepository} the corresponding implementation class will be looked up scanning * for {@code PersonRepositoryImpl}. * - * @return + * @return {@literal Impl} by default. */ String repositoryImplementationPostfix() default "Impl"; @@ -92,7 +92,7 @@ public @interface EnableReactiveMongoRepositories { * Configures the location of where to find the Spring Data named queries properties file. Will default to * {@code META-INF/mongo-named-queries.properties}. * - * @return + * @return empty {@link String} by default. */ String namedQueriesLocation() default ""; @@ -100,7 +100,7 @@ public @interface EnableReactiveMongoRepositories { * Returns the key of the {@link QueryLookupStrategy} to be used for lookup queries for query methods. Defaults to * {@link Key#CREATE_IF_NOT_FOUND}. * - * @return + * @return {@link Key#CREATE_IF_NOT_FOUND} by default. */ Key queryLookupStrategy() default Key.CREATE_IF_NOT_FOUND; @@ -108,34 +108,36 @@ public @interface EnableReactiveMongoRepositories { * Returns the {@link FactoryBean} class to be used for each repository instance. Defaults to * {@link MongoRepositoryFactoryBean}. * - * @return + * @return {@link ReactiveMongoRepositoryFactoryBean} by default. */ Class repositoryFactoryBeanClass() default ReactiveMongoRepositoryFactoryBean.class; /** * Configure the repository base class to be used to create repository proxies for this particular configuration. * - * @return + * @return {@link DefaultRepositoryBaseClass} by default. */ Class repositoryBaseClass() default DefaultRepositoryBaseClass.class; /** * Configures the name of the {@link MongoTemplate} bean to be used with the repositories detected. * - * @return + * @return {@literal reactiveMongoTemplate} by default. */ String reactiveMongoTemplateRef() default "reactiveMongoTemplate"; /** * Whether to automatically create indexes for query methods defined in the repository interface. * - * @return + * @return {@literal false} by default. */ boolean createIndexesForQueryMethods() default false; /** * Configures whether nested repository-interfaces (e.g. defined as inner classes) should be discovered by the * repositories infrastructure. + * + * @return {@literal false} by default. */ boolean considerNestedRepositories() default false; } diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/ConvertingParameterAccessor.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/ConvertingParameterAccessor.java index 7e05ad95f..30ce2e81a 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/ConvertingParameterAccessor.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/ConvertingParameterAccessor.java @@ -159,7 +159,7 @@ public class ConvertingParameterAccessor implements MongoParameterAccessor { * * @param value can be {@literal null}. * @param typeInformation can be {@literal null}. - * @return + * @return can be {@literal null}. */ @Nullable private Object getConvertedValue(Object value, @Nullable TypeInformation typeInformation) { @@ -251,8 +251,8 @@ public class ConvertingParameterAccessor implements MongoParameterAccessor { * array. Will return an empty {@link Collection} in case {@literal null} is given. Will wrap all other types into a * single-element collection. * - * @param source - * @return + * @param source can be {@literal null}, returns an empty {@link List} in that case. + * @return never {@literal null}. */ private static Collection asCollection(@Nullable Object source) { diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/DtoInstantiatingConverter.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/DtoInstantiatingConverter.java index c7f4e2a23..bb1d11209 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/DtoInstantiatingConverter.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/repository/query/DtoInstantiatingConverter.java @@ -47,19 +47,19 @@ class DtoInstantiatingConverter implements Converter { * * @param dtoType must not be {@literal null}. * @param context must not be {@literal null}. - * @param instantiators must not be {@literal null}. + * @param entityInstantiators must not be {@literal null}. */ public DtoInstantiatingConverter(Class dtoType, MappingContext, MongoPersistentProperty> context, - EntityInstantiators instantiator) { + EntityInstantiators entityInstantiators) { Assert.notNull(dtoType, "DTO type must not be null!"); Assert.notNull(context, "MappingContext must not be null!"); - Assert.notNull(instantiator, "EntityInstantiators must not be null!"); + Assert.notNull(entityInstantiators, "EntityInstantiators must not be null!"); this.targetType = dtoType; this.context = context; - this.instantiator = instantiator.getInstantiatorFor(context.getRequiredPersistentEntity(dtoType)); + this.instantiator = entityInstantiators.getInstantiatorFor(context.getRequiredPersistentEntity(dtoType)); } /* diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util/json/package-info.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util/json/package-info.java new file mode 100644 index 000000000..ce2f20fcc --- /dev/null +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/util/json/package-info.java @@ -0,0 +1,21 @@ +/* + * Copyright 2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * MongoDB driver-specific utility classes for Json conversion. + */ +@org.springframework.lang.NonNullApi +package org.springframework.data.mongodb.util.json; diff --git a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java index e332fdf23..e7027a05a 100644 --- a/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java +++ b/spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/MongoTemplateTests.java @@ -1297,9 +1297,9 @@ public class MongoTemplateTests { } }, new CursorPreparer() { - public FindIterable prepare(FindIterable cursor) { - cursor.limit(1); - return cursor; + public FindIterable prepare(FindIterable iterable) { + iterable.limit(1); + return iterable; } });