Skip to content

Commit 560a20f

Browse files
committed
DATAMONGO-1421 - Polishing.
Remove trailing whitespaces. Construct exception message with String.format(…). Original pull request: #448.
1 parent 9c035a1 commit 560a20f

File tree

1 file changed

+16
-16
lines changed
  • spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/query

1 file changed

+16
-16
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class Query {
5959

6060
/**
6161
* Static factory method to create a {@link Query} using the provided {@link CriteriaDefinition}.
62-
*
62+
*
6363
* @param criteriaDefinition must not be {@literal null}.
6464
* @return
6565
* @since 1.6
@@ -72,7 +72,7 @@ public Query() {}
7272

7373
/**
7474
* Creates a new {@link Query} using the given {@link CriteriaDefinition}.
75-
*
75+
*
7676
* @param criteriaDefinition must not be {@literal null}.
7777
* @since 1.6
7878
*/
@@ -82,7 +82,7 @@ public Query(CriteriaDefinition criteriaDefinition) {
8282

8383
/**
8484
* Adds the given {@link CriteriaDefinition} to the current {@link Query}.
85-
*
85+
*
8686
* @param criteriaDefinition must not be {@literal null}.
8787
* @return
8888
* @since 1.6
@@ -96,8 +96,8 @@ public Query addCriteria(CriteriaDefinition criteriaDefinition) {
9696
this.criteria.put(key, criteriaDefinition);
9797
} else {
9898
throw new InvalidMongoDbApiUsageException(
99-
"Due to limitations of the com.mongodb.BasicDBObject, " + "you can't add a second '" + key + "' criteria. "
100-
+ "Query already contains '" + serializeToJsonSafely(existing.getCriteriaObject()) + "'.");
99+
String.format("Due to limitations of the com.mongodb.BasicDBObject, you can't add a second '%s' criteria. "
100+
+ "Query already contains '%s'", key, serializeToJsonSafely(existing.getCriteriaObject())));
101101
}
102102

103103
return this;
@@ -112,7 +112,7 @@ public Field fields() {
112112

113113
/**
114114
* Set number of documents to skip before returning results.
115-
*
115+
*
116116
* @param skip
117117
* @return
118118
*/
@@ -123,7 +123,7 @@ public Query skip(int skip) {
123123

124124
/**
125125
* Limit the number of returned documents to {@code limit}.
126-
*
126+
*
127127
* @param limit
128128
* @return
129129
*/
@@ -134,7 +134,7 @@ public Query limit(int limit) {
134134

135135
/**
136136
* Configures the query to use the given hint when being executed.
137-
*
137+
*
138138
* @param name must not be {@literal null} or empty.
139139
* @return
140140
*/
@@ -147,7 +147,7 @@ public Query withHint(String name) {
147147
/**
148148
* Sets the given pagination information on the {@link Query} instance. Will transparently set {@code skip} and
149149
* {@code limit} as well as applying the {@link Sort} instance defined with the {@link Pageable}.
150-
*
150+
*
151151
* @param pageable
152152
* @return
153153
*/
@@ -165,7 +165,7 @@ public Query with(Pageable pageable) {
165165

166166
/**
167167
* Adds a {@link Sort} to the {@link Query} instance.
168-
*
168+
*
169169
* @param sort
170170
* @return
171171
*/
@@ -200,7 +200,7 @@ public Set<Class<?>> getRestrictedTypes() {
200200

201201
/**
202202
* Restricts the query to only return documents instances that are exactly of the given types.
203-
*
203+
*
204204
* @param type may not be {@literal null}
205205
* @param additionalTypes may not be {@literal null}
206206
* @return
@@ -254,7 +254,7 @@ public DBObject getSortObject() {
254254

255255
/**
256256
* Get the number of documents to skip.
257-
*
257+
*
258258
* @return
259259
*/
260260
public int getSkip() {
@@ -263,7 +263,7 @@ public int getSkip() {
263263

264264
/**
265265
* Get the maximum number of documents to be return.
266-
*
266+
*
267267
* @return
268268
*/
269269
public int getLimit() {
@@ -433,7 +433,7 @@ public boolean equals(Object obj) {
433433

434434
/**
435435
* Tests whether the settings of the given {@link Query} are equal to this query.
436-
*
436+
*
437437
* @param that
438438
* @return
439439
*/
@@ -450,7 +450,7 @@ protected boolean querySettingsEquals(Query that) {
450450
return criteriaEqual && fieldsEqual && sortEqual && hintEqual && skipEqual && limitEqual && metaEqual;
451451
}
452452

453-
/*
453+
/*
454454
* (non-Javadoc)
455455
* @see java.lang.Object#hashCode()
456456
*/
@@ -472,7 +472,7 @@ public int hashCode() {
472472

473473
/**
474474
* Returns whether the given key is the one used to hold the type restriction information.
475-
*
475+
*
476476
* @deprecated don't call this method as the restricted type handling will undergo some significant changes going
477477
* forward.
478478
* @param key

0 commit comments

Comments
 (0)