Skip to content

Commit be0b941

Browse files
christophstroblmp911de
authored andcommitted
DATAMONGO-2509 - Update Javadoc.
Original pull request: #853.
1 parent 93df58a commit be0b941

File tree

120 files changed

+1258
-1010
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+1258
-1010
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/LazyLoadingException.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ public class LazyLoadingException extends UncategorizedDataAccessException {
2525
private static final long serialVersionUID = -7089224903873220037L;
2626

2727
/**
28-
* @param msg
29-
* @param cause
28+
* Constructor for LazyLoadingException.
29+
*
30+
* @param msg the detail message.
31+
* @param cause the exception thrown by underlying data access API.
3032
*/
3133
public LazyLoadingException(String msg, Throwable cause) {
3234
super(msg, cause);

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/MongoDbFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public interface MongoDbFactory extends CodecRegistryProvider, MongoSessionProvi
3737
/**
3838
* Creates a default {@link MongoDatabase} instance.
3939
*
40-
* @return
40+
* @return never {@literal null}.
4141
* @throws DataAccessException
4242
*/
4343
MongoDatabase getDb() throws DataAccessException;
@@ -46,7 +46,7 @@ public interface MongoDbFactory extends CodecRegistryProvider, MongoSessionProvi
4646
* Creates a {@link DB} instance to access the database with the given name.
4747
*
4848
* @param dbName must not be {@literal null} or empty.
49-
* @return
49+
* @return never {@literal null}.
5050
* @throws DataAccessException
5151
*/
5252
MongoDatabase getDb(String dbName) throws DataAccessException;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/ReactiveMongoDatabaseFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public interface ReactiveMongoDatabaseFactory extends CodecRegistryProvider {
3838
/**
3939
* Creates a default {@link MongoDatabase} instance.
4040
*
41-
* @return
41+
* @return never {@literal null}.
4242
* @throws DataAccessException
4343
*/
4444
MongoDatabase getMongoDatabase() throws DataAccessException;
@@ -47,7 +47,7 @@ public interface ReactiveMongoDatabaseFactory extends CodecRegistryProvider {
4747
* Creates a {@link MongoDatabase} instance to access the database with the given name.
4848
*
4949
* @param dbName must not be {@literal null} or empty.
50-
* @return
50+
* @return never {@literal null}.
5151
* @throws DataAccessException
5252
*/
5353
MongoDatabase getMongoDatabase(String dbName) throws DataAccessException;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/EnableMongoAuditing.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,29 @@
4242
/**
4343
* Configures the {@link AuditorAware} bean to be used to lookup the current principal.
4444
*
45-
* @return
45+
* @return empty {@link String} by default.
4646
*/
4747
String auditorAwareRef() default "";
4848

4949
/**
5050
* Configures whether the creation and modification dates are set. Defaults to {@literal true}.
5151
*
52-
* @return
52+
* @return {@literal true} by default.
5353
*/
5454
boolean setDates() default true;
5555

5656
/**
5757
* Configures whether the entity shall be marked as modified on creation. Defaults to {@literal true}.
5858
*
59-
* @return
59+
* @return {@literal true} by default.
6060
*/
6161
boolean modifyOnCreate() default true;
6262

6363
/**
6464
* Configures a {@link DateTimeProvider} bean name that allows customizing the {@link org.joda.time.DateTime} to be
6565
* used for setting creation and modification dates.
6666
*
67-
* @return
67+
* @return empty {@link String} by default.
6868
*/
6969
String dateTimeProviderRef() default "";
7070
}

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/config/MongoConfigurationSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public MongoMappingContext mongoMappingContext() throws ClassNotFoundException {
8989
/**
9090
* Register custom {@link Converter}s in a {@link CustomConversions} object if required. These
9191
* {@link CustomConversions} will be registered with the {@link #mappingMongoConverter()} and
92-
* {@link #mongoMappingContext()}. Returns an empty {@link MongoCustomConversions} instance by default.
92+
* {@link MongoMappingContext}. Returns an empty {@link MongoCustomConversions} instance by default.
9393
*
9494
* @return must not be {@literal null}.
9595
*/

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/BulkOperations.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ enum BulkMode {
9494
* Add a list of updates to the bulk operation. For each update request, all matching documents are updated.
9595
*
9696
* @param updates Update operations to perform.
97-
* @return The bulk operation.
9897
* @return the current {@link BulkOperations} instance with the update added, will never be {@literal null}.
9998
*/
10099
BulkOperations updateMulti(List<Pair<Query, Update>> updates);
@@ -105,7 +104,6 @@ enum BulkMode {
105104
*
106105
* @param query Update criteria.
107106
* @param update Update operation to perform.
108-
* @return The bulk operation.
109107
* @return the current {@link BulkOperations} instance with the update added, will never be {@literal null}.
110108
*/
111109
BulkOperations upsert(Query query, Update update);
@@ -115,7 +113,6 @@ enum BulkMode {
115113
* else an insert.
116114
*
117115
* @param updates Updates/insert operations to perform.
118-
* @return The bulk operation.
119116
* @return the current {@link BulkOperations} instance with the update added, will never be {@literal null}.
120117
*/
121118
BulkOperations upsert(List<Pair<Query, Update>> updates);

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionCallback.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @author Grame Rocher
3030
* @author Oliver Gierke
3131
* @author John Brisbin
32-
* @auhtor Christoph Strobl
32+
* @author Christoph Strobl
3333
* @since 1.0
3434
*/
3535
public interface CollectionCallback<T> {

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CollectionOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public static CollectionOptions empty() {
9595

9696
/**
9797
* Create new {@link CollectionOptions} with already given settings and capped set to {@literal true}. <br />
98-
* <strong>NOTE</strong> Using capped collections requires defining {@link #size(int)}.
98+
* <strong>NOTE</strong> Using capped collections requires defining {@link #size(long)}.
9999
*
100100
* @return new {@link CollectionOptions}.
101101
* @since 2.0

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/CursorPreparer.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,18 @@ public interface CursorPreparer extends ReadPreferenceAware {
4343
/**
4444
* Prepare the given cursor (apply limits, skips and so on). Returns the prepared cursor.
4545
*
46-
* @param cursor
46+
* @param iterable must not be {@literal null}.
47+
* @return never {@literal null}.
4748
*/
48-
FindIterable<Document> prepare(FindIterable<Document> cursor);
49+
FindIterable<Document> prepare(FindIterable<Document> iterable);
4950

5051
/**
5152
* Apply query specific settings to {@link MongoCollection} and initate a find operation returning a
5253
* {@link FindIterable} via the given {@link Function find} function.
5354
*
5455
* @param collection must not be {@literal null}.
5556
* @param find must not be {@literal null}.
56-
* @return
57+
* @return never {@literal null}.
5758
* @throws IllegalArgumentException if one of the required arguments is {@literal null}.
5859
* @since 2.2
5960
*/

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/DocumentCallbackHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/**
2424
* An interface used by {@link MongoTemplate} for processing documents returned from a MongoDB query on a per-document
2525
* basis. Implementations of this interface perform the actual work of prcoessing each document but don't need to worry
26-
* about exception handling. {@MongoException}s will be caught and translated by the calling MongoTemplate An
26+
* about exception handling. {@link MongoException}s will be caught and translated by the calling MongoTemplate An
2727
* DocumentCallbackHandler is typically stateful: It keeps the result state within the object, to be available later for
2828
* later inspection.
2929
*

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/EntityOperations.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class EntityOperations {
6666
* Creates a new {@link Entity} for the given bean.
6767
*
6868
* @param entity must not be {@literal null}.
69-
* @return
69+
* @return new instance of {@link Entity}.
7070
*/
7171
@SuppressWarnings({ "unchecked", "rawtypes" })
7272
public <T> Entity<T> forEntity(T entity) {
@@ -89,7 +89,7 @@ public <T> Entity<T> forEntity(T entity) {
8989
*
9090
* @param entity must not be {@literal null}.
9191
* @param conversionService must not be {@literal null}.
92-
* @return
92+
* @return new instance of {@link AdaptibleEntity}.
9393
*/
9494
@SuppressWarnings({ "unchecked", "rawtypes" })
9595
public <T> AdaptibleEntity<T> forEntity(T entity, ConversionService conversionService) {
@@ -108,6 +108,10 @@ public <T> AdaptibleEntity<T> forEntity(T entity, ConversionService conversionSe
108108
return AdaptibleMappedEntity.of(entity, context, conversionService);
109109
}
110110

111+
/**
112+
* @param entityClass should not be null.
113+
* @return the {@link MongoPersistentEntity#getCollection() collection name}.
114+
*/
111115
public String determineCollectionName(@Nullable Class<?> entityClass) {
112116

113117
if (entityClass == null) {
@@ -138,7 +142,7 @@ public Query getByIdInQuery(Collection<?> entities) {
138142
* {@code _id} if no identifier property can be found.
139143
*
140144
* @param type must not be {@literal null}.
141-
* @return
145+
* @return never {@literal null}.
142146
*/
143147
public String getIdPropertyName(Class<?> type) {
144148

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableAggregationOperation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ interface TerminatingAggregation<T> {
8888

8989
/**
9090
* Apply pipeline operations as specified and stream all matching elements. <br />
91-
* Returns a {@link CloseableIterator} that wraps the a Mongo DB {@link com.mongodb.Cursor}
91+
* Returns a {@link CloseableIterator} that wraps the a Mongo DB {@link com.mongodb.client.FindIterable}
9292
*
93-
* @return a {@link CloseableIterator} that wraps the a Mongo DB {@link com.mongodb.Cursor} that needs to be closed.
94-
* Never {@literal null}.
93+
* @return a {@link CloseableIterator} that wraps the a Mongo DB {@link com.mongodb.client.FindIterable} that needs
94+
* to be closed. Never {@literal null}.
9595
*/
9696
CloseableIterator<T> stream();
9797
}

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ default Optional<T> first() {
117117
/**
118118
* Stream all matching elements.
119119
*
120-
* @return a {@link Stream} that wraps the a Mongo DB {@link com.mongodb.Cursor} that needs to be closed. Never
121-
* {@literal null}.
120+
* @return a {@link Stream} that wraps the a Mongo DB {@link com.mongodb.client.FindIterable} that needs to be
121+
* closed. Never {@literal null}.
122122
*/
123123
Stream<T> stream();
124124

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ExecutableFindOperationSupport.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package org.springframework.data.mongodb.core;
1717

18-
import com.mongodb.ReadPreference;
1918
import lombok.AccessLevel;
2019
import lombok.NonNull;
2120
import lombok.RequiredArgsConstructor;
@@ -26,6 +25,7 @@
2625
import java.util.stream.Stream;
2726

2827
import org.bson.Document;
28+
2929
import org.springframework.dao.IncorrectResultSizeDataAccessException;
3030
import org.springframework.data.mongodb.core.query.NearQuery;
3131
import org.springframework.data.mongodb.core.query.Query;
@@ -37,6 +37,7 @@
3737
import org.springframework.util.ObjectUtils;
3838
import org.springframework.util.StringUtils;
3939

40+
import com.mongodb.ReadPreference;
4041
import com.mongodb.client.FindIterable;
4142

4243
/**
@@ -257,9 +258,9 @@ static class DelegatingQueryCursorPreparer implements CursorPreparer {
257258
* @see org.springframework.data.mongodb.core.CursorPreparer#prepare(com.mongodb.clientFindIterable)
258259
*/
259260
@Override
260-
public FindIterable<Document> prepare(FindIterable<Document> cursor) {
261+
public FindIterable<Document> prepare(FindIterable<Document> iterable) {
261262

262-
FindIterable<Document> target = delegate != null ? delegate.prepare(cursor) : cursor;
263+
FindIterable<Document> target = delegate != null ? delegate.prepare(iterable) : iterable;
263264
return limit.map(target::limit).orElse(target);
264265
}
265266

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndModifyOptions.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static FindAndModifyOptions none() {
7878
}
7979

8080
/**
81-
* Create new {@link FindAndModifyOptions} based on option of given {@litearl source}.
81+
* Create new {@link FindAndModifyOptions} based on option of given {@literal source}.
8282
*
8383
* @param source can be {@literal null}.
8484
* @return new instance of {@link FindAndModifyOptions}.
@@ -117,8 +117,8 @@ public FindAndModifyOptions remove(boolean remove) {
117117
/**
118118
* Define the {@link Collation} specifying language-specific rules for string comparison.
119119
*
120-
* @param collation
121-
* @return
120+
* @param collation can be {@literal null}.
121+
* @return this.
122122
* @since 2.0
123123
*/
124124
public FindAndModifyOptions collation(@Nullable Collation collation) {
@@ -142,7 +142,7 @@ public boolean isRemove() {
142142
/**
143143
* Get the {@link Collation} specifying language-specific rules for string comparison.
144144
*
145-
* @return
145+
* @return never {@literal null}.
146146
* @since 2.0
147147
*/
148148
public Optional<Collation> getCollation() {

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindAndReplaceOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public FindAndReplaceOptions upsert() {
116116
/**
117117
* Get the bit indicating to return the replacement document.
118118
*
119-
* @return
119+
* @return {@literal true} if set.
120120
*/
121121
public boolean isReturnNew() {
122122
return returnNew;
@@ -125,7 +125,7 @@ public boolean isReturnNew() {
125125
/**
126126
* Get the bit indicating if to create a new document if not exists.
127127
*
128-
* @return
128+
* @return {@literal true} if set.
129129
*/
130130
public boolean isUpsert() {
131131
return upsert;

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/FindPublisherPreparer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public interface FindPublisherPreparer extends ReadPreferenceAware {
5454
*
5555
* @param collection must not be {@literal null}.
5656
* @param find must not be {@literal null}.
57-
* @return
57+
* @return never {@literal null}.
5858
* @throws IllegalArgumentException if one of the required arguments is {@literal null}.
5959
* @since 2.2
6060
*/

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/GeoCommandStatistics.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private GeoCommandStatistics(Document source) {
4747
* Creates a new {@link GeoCommandStatistics} from the given command result extracting the statistics.
4848
*
4949
* @param commandResult must not be {@literal null}.
50-
* @return
50+
* @return never {@literal null}.
5151
*/
5252
public static GeoCommandStatistics from(Document commandResult) {
5353

@@ -61,7 +61,7 @@ public static GeoCommandStatistics from(Document commandResult) {
6161
* Returns the average distance reported by the command result. Mitigating a removal of the field in case the command
6262
* didn't return any result introduced in MongoDB 3.2 RC1.
6363
*
64-
* @return
64+
* @return never {@literal null}, uses {@link Double#NaN} if {@literal avgDistance} does not exist.
6565
* @see <a href="https://jira.mongodb.org/browse/SERVER-21024">MongoDB Jira SERVER-21024</a>
6666
*/
6767
public double getAverageDistance() {

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoOperations.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public interface MongoOperations extends FluentMongoOperations {
7878
* The collection name used for the specified class by this template.
7979
*
8080
* @param entityClass must not be {@literal null}.
81-
* @return
81+
* @return never {@literal null}.
8282
*/
8383
String getCollectionName(Class<?> entityClass);
8484

@@ -360,7 +360,7 @@ public <T> T execute(SessionCallback<T> action, Consumer<ClientSession> onComple
360360
/**
361361
* Returns the {@link ScriptOperations} that can be performed on {@link com.mongodb.DB} level.
362362
*
363-
* @return
363+
* @return never {@literal null}.
364364
* @since 1.7
365365
* @deprecated since 2.2. The {@code eval} command has been removed without replacement in MongoDB Server 4.2.0.
366366
*/
@@ -1520,7 +1520,7 @@ <S, T> T findAndReplace(Query query, S replacement, FindAndReplaceOptions option
15201520
/**
15211521
* Returns the underlying {@link MongoConverter}.
15221522
*
1523-
* @return
1523+
* @return never {@literal null}.
15241524
*/
15251525
MongoConverter getConverter();
15261526
}

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/MongoTemplate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,9 +3262,9 @@ public QueryCursorPreparer(Query query, @Nullable Class<?> type) {
32623262
* (non-Javadoc)
32633263
* @see org.springframework.data.mongodb.core.CursorPreparer#prepare(com.mongodb.DBCursor)
32643264
*/
3265-
public FindIterable<Document> prepare(FindIterable<Document> cursor) {
3265+
public FindIterable<Document> prepare(FindIterable<Document> iterable) {
32663266

3267-
FindIterable<Document> cursorToUse = cursor;
3267+
FindIterable<Document> cursorToUse = iterable;
32683268

32693269
operations.forType(type).getCollation(query) //
32703270
.map(Collation::toMongoCollation) //

0 commit comments

Comments
 (0)