Skip to content

Commit be8a73f

Browse files
committed
Fix typos in MongoDb components JavaDocs
1 parent a75fc03 commit be8a73f

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/inbound/MongoDbMessageSource.java

+21-25
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.springframework.integration.mongodb.support.MongoHeaders;
3535
import org.springframework.integration.support.AbstractIntegrationMessageBuilder;
3636
import org.springframework.integration.transaction.IntegrationResourceHolder;
37+
import org.springframework.lang.Nullable;
3738
import org.springframework.transaction.support.TransactionSynchronizationManager;
3839
import org.springframework.util.Assert;
3940
import org.springframework.util.CollectionUtils;
@@ -45,7 +46,7 @@
4546
* a {@link org.springframework.messaging.Message} with a payload which is the result of
4647
* execution of a {@link Query}. When expectSingleResult is false (default), the MongoDb
4748
* {@link Query} is executed using {@link MongoOperations#find(Query, Class)} method which
48-
* returns a {@link List}. The returned {@link List} will be used as the payoad of the
49+
* returns a {@link List}. The returned {@link List} will be used as the payload of the
4950
* {@link org.springframework.messaging.Message} returned by the {{@link #receive()}
5051
* method. An empty {@link List} is treated as null, thus resulting in no
5152
* {@link org.springframework.messaging.Message} returned by the {{@link #receive()}
@@ -65,44 +66,42 @@
6566
*/
6667
public class MongoDbMessageSource extends AbstractMessageSource<Object> {
6768

68-
private final Expression queryExpression;
69+
@Nullable
70+
private final MongoDbFactory mongoDbFactory;
6971

70-
private volatile Expression collectionNameExpression = new LiteralExpression("data");
72+
private final Expression queryExpression;
7173

72-
private volatile StandardEvaluationContext evaluationContext;
74+
private Expression collectionNameExpression = new LiteralExpression("data");
7375

74-
private volatile MongoOperations mongoTemplate;
76+
private StandardEvaluationContext evaluationContext;
7577

76-
private volatile MongoConverter mongoConverter;
78+
private MongoOperations mongoTemplate;
7779

78-
private volatile MongoDbFactory mongoDbFactory;
80+
private MongoConverter mongoConverter;
7981

80-
private volatile boolean initialized = false;
82+
private Class<?> entityClass = DBObject.class;
8183

82-
private volatile Class<?> entityClass = DBObject.class;
84+
private boolean expectSingleResult = false;
8385

84-
private volatile boolean expectSingleResult = false;
86+
private volatile boolean initialized = false;
8587

8688
/**
8789
* Creates an instance with the provided {@link MongoDbFactory} and SpEL expression
88-
* which should resolve to a MongoDb 'query' string
89-
* (see https://www.mongodb.org/display/DOCS/Querying).
90+
* which should resolve to a MongoDb 'query' string (see https://www.mongodb.org/display/DOCS/Querying).
9091
* The 'queryExpression' will be evaluated on every call to the {@link #receive()} method.
9192
* @param mongoDbFactory The mongodb factory.
9293
* @param queryExpression The query expression.
9394
*/
9495
public MongoDbMessageSource(MongoDbFactory mongoDbFactory, Expression queryExpression) {
9596
Assert.notNull(mongoDbFactory, "'mongoDbFactory' must not be null");
9697
Assert.notNull(queryExpression, "'queryExpression' must not be null");
97-
9898
this.mongoDbFactory = mongoDbFactory;
9999
this.queryExpression = queryExpression;
100100
}
101101

102102
/**
103103
* Creates an instance with the provided {@link MongoOperations} and SpEL expression
104-
* which should resolve to a Mongo 'query' string
105-
* (see https://www.mongodb.org/display/DOCS/Querying).
104+
* which should resolve to a Mongo 'query' string (see https://www.mongodb.org/display/DOCS/Querying).
106105
* It assumes that the {@link MongoOperations} is fully initialized and ready to be used.
107106
* The 'queryExpression' will be evaluated on every call to the {@link #receive()} method.
108107
* @param mongoTemplate The mongo template.
@@ -111,15 +110,14 @@ public MongoDbMessageSource(MongoDbFactory mongoDbFactory, Expression queryExpre
111110
public MongoDbMessageSource(MongoOperations mongoTemplate, Expression queryExpression) {
112111
Assert.notNull(mongoTemplate, "'mongoTemplate' must not be null");
113112
Assert.notNull(queryExpression, "'queryExpression' must not be null");
114-
113+
this.mongoDbFactory = null;
115114
this.mongoTemplate = mongoTemplate;
116115
this.queryExpression = queryExpression;
117116
}
118117

119118
/**
120119
* Allows you to set the type of the entityClass that will be passed to the
121-
* {@link MongoTemplate#find(Query, Class)} or {@link MongoTemplate#findOne(Query, Class)}
122-
* method.
120+
* {@link MongoTemplate#find(Query, Class)} or {@link MongoTemplate#findOne(Query, Class)} method.
123121
* Default is {@link DBObject}.
124122
* @param entityClass The entity class.
125123
*/
@@ -135,7 +133,7 @@ public void setEntityClass(Class<?> entityClass) {
135133
* {@link #receive()} will use {@link MongoTemplate#findOne(Query, Class)},
136134
* and the payload of the returned {@link org.springframework.messaging.Message}
137135
* will be the returned target Object of type
138-
* identified by {{@link #entityClass} instead of a List.
136+
* identified by {@link #entityClass} instead of a List.
139137
* @param expectSingleResult true if a single result is expected.
140138
*/
141139
public void setExpectSingleResult(boolean expectSingleResult) {
@@ -188,8 +186,8 @@ protected void onInit() {
188186
/**
189187
* Will execute a {@link Query} returning its results as the Message payload.
190188
* The payload can be either {@link List} of elements of objects of type
191-
* identified by {{@link #entityClass}, or a single element of type identified by {{@link #entityClass}
192-
* based on the value of {{@link #expectSingleResult} attribute which defaults to 'false' resulting
189+
* identified by {@link #entityClass}, or a single element of type identified by {@link #entityClass}
190+
* based on the value of {@link #expectSingleResult} attribute which defaults to 'false' resulting
193191
* {@link org.springframework.messaging.Message} with payload of type
194192
* {@link List}. The collection name used in the
195193
* query will be provided in the {@link MongoHeaders#COLLECTION_NAME} header.
@@ -218,12 +216,10 @@ else if (value instanceof Query) {
218216

219217
Object result = null;
220218
if (this.expectSingleResult) {
221-
result = this.mongoTemplate.
222-
findOne(query, this.entityClass, collectionName);
219+
result = this.mongoTemplate.findOne(query, this.entityClass, collectionName);
223220
}
224221
else {
225-
List<?> results = this.mongoTemplate.
226-
find(query, this.entityClass, collectionName);
222+
List<?> results = this.mongoTemplate.find(query, this.entityClass, collectionName);
227223
if (!CollectionUtils.isEmpty(results)) {
228224
result = results;
229225
}

spring-integration-mongodb/src/main/java/org/springframework/integration/mongodb/inbound/ReactiveMongoDbMessageSource.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.springframework.integration.endpoint.AbstractMessageSource;
3636
import org.springframework.integration.expression.ExpressionUtils;
3737
import org.springframework.integration.mongodb.support.MongoHeaders;
38+
import org.springframework.lang.Nullable;
3839
import org.springframework.util.Assert;
3940

4041
import com.mongodb.DBObject;
@@ -55,12 +56,16 @@
5556
* query.
5657
*
5758
* @author David Turanski
59+
* @author Artem Bilan
5860
*
5961
* @since 5.3
6062
*/
6163
public class ReactiveMongoDbMessageSource extends AbstractMessageSource<Publisher<?>>
6264
implements ApplicationContextAware {
6365

66+
@Nullable
67+
private final ReactiveMongoDatabaseFactory reactiveMongoDatabaseFactory;
68+
6469
private final Expression queryExpression;
6570

6671
private Expression collectionNameExpression = new LiteralExpression("data");
@@ -71,8 +76,6 @@ public class ReactiveMongoDbMessageSource extends AbstractMessageSource<Publishe
7176

7277
private MongoConverter mongoConverter;
7378

74-
private ReactiveMongoDatabaseFactory reactiveMongoDatabaseFactory;
75-
7679
private Class<?> entityClass = DBObject.class;
7780

7881
private boolean expectSingleResult = false;
@@ -93,7 +96,6 @@ public ReactiveMongoDbMessageSource(ReactiveMongoDatabaseFactory reactiveMongoDa
9396

9497
Assert.notNull(reactiveMongoDatabaseFactory, "'reactiveMongoDatabaseFactory' must not be null");
9598
Assert.notNull(queryExpression, "'queryExpression' must not be null");
96-
9799
this.reactiveMongoDatabaseFactory = reactiveMongoDatabaseFactory;
98100
this.queryExpression = queryExpression;
99101
}
@@ -109,6 +111,7 @@ public ReactiveMongoDbMessageSource(ReactiveMongoDatabaseFactory reactiveMongoDa
109111
public ReactiveMongoDbMessageSource(ReactiveMongoOperations reactiveMongoTemplate, Expression queryExpression) {
110112
Assert.notNull(reactiveMongoTemplate, "'reactiveMongoTemplate' must not be null");
111113
Assert.notNull(queryExpression, "'queryExpression' must not be null");
114+
this.reactiveMongoDatabaseFactory = null;
112115
this.reactiveMongoTemplate = reactiveMongoTemplate;
113116
this.queryExpression = queryExpression;
114117
}

0 commit comments

Comments
 (0)