Skip to content

Commit 0020499

Browse files
committed
Polishing.
Reformat code. See #2750 Original pull request: #4316
1 parent f4b8524 commit 0020499

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

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

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.bson.Document;
1919
import org.springframework.data.mongodb.core.aggregation.EvaluationOperators.Expr;
2020
import org.springframework.data.mongodb.core.query.CriteriaDefinition;
21-
import org.springframework.lang.Nullable;
2221

2322
/**
2423
* A {@link CriteriaDefinition criteria} to use {@code $expr} within a
@@ -52,7 +51,6 @@ public Document getCriteriaObject() {
5251
return new Document(getKey(), expression);
5352
}
5453

55-
@Nullable
5654
@Override
5755
public String getKey() {
5856
return "$expr";

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

+6-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.springframework.data.mapping.context.InvalidPersistentPropertyPath;
4242
import org.springframework.data.mapping.context.MappingContext;
4343
import org.springframework.data.mongodb.MongoExpression;
44-
import org.springframework.data.mongodb.core.aggregation.Aggregation;
4544
import org.springframework.data.mongodb.core.aggregation.AggregationExpression;
4645
import org.springframework.data.mongodb.core.aggregation.RelaxedTypeBasedAggregationOperationContext;
4746
import org.springframework.data.mongodb.core.convert.MappingMongoConverter.NestedDocument;
@@ -563,10 +562,12 @@ protected Object convertSimpleOrDocument(Object source, @Nullable MongoPersisten
563562
return exampleMapper.getMappedExample((Example<?>) source, entity);
564563
}
565564

566-
if(source instanceof MongoExpression exr) {
567-
if(source instanceof AggregationExpression age) {
568-
return age.toDocument(new RelaxedTypeBasedAggregationOperationContext(entity.getType(), this.mappingContext, this));
569-
}
565+
if (source instanceof AggregationExpression age) {
566+
return age
567+
.toDocument(new RelaxedTypeBasedAggregationOperationContext(entity.getType(), this.mappingContext, this));
568+
}
569+
570+
if (source instanceof MongoExpression exr) {
570571
return exr.toDocument();
571572
}
572573

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

+10-12
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ public static Criteria matchingDocumentStructure(MongoJsonSchema schema) {
158158
* <pre class="code">
159159
* expr(() -> Document.parse("{ $gt : [ '$spent', '$budget'] }")))
160160
* </pre>
161-
*
161+
*
162162
* or an {@link org.springframework.data.mongodb.core.aggregation.AggregationExpression} which will be subject to
163163
* context (domain type) specific field mapping.
164164
*
165165
* <pre class="code">
166166
* expr(valueOf("amountSpent").greaterThan("budget"))
167167
* </pre>
168-
*
168+
*
169169
* @param expression must not be {@literal null}.
170170
* @return new instance of {@link Criteria}.
171171
* @since 4.1
@@ -211,8 +211,7 @@ public Criteria is(@Nullable Object value) {
211211

212212
/**
213213
* Creates a criterion using {@literal null} equality comparison which matches documents that either contain the item
214-
* field whose value is {@literal null} or that do not contain the item field.
215-
* <br />
214+
* field whose value is {@literal null} or that do not contain the item field. <br />
216215
* Use {@link #isNullValue()} to only query for documents that contain the field whose value is equal to
217216
* {@link org.bson.BsonType#NULL}. <br />
218217
* Use {@link #exists(boolean)} to query for documents that do (not) contain the field.
@@ -228,10 +227,9 @@ public Criteria isNull() {
228227

229228
/**
230229
* Creates a criterion using a {@link org.bson.BsonType} comparison which matches only documents that contain the item
231-
* field whose value is equal to {@link org.bson.BsonType#NULL}.
232-
* <br />
233-
* Use {@link #isNull()} to query for documents that contain the field with a {@literal null} value or do not contain the
234-
* field at all. <br />
230+
* field whose value is equal to {@link org.bson.BsonType#NULL}. <br />
231+
* Use {@link #isNull()} to query for documents that contain the field with a {@literal null} value or do not contain
232+
* the field at all. <br />
235233
* Use {@link #exists(boolean)} to query for documents that do (not) contain the field.
236234
*
237235
* @return this.
@@ -659,8 +657,8 @@ public Criteria intersects(GeoJson geoJson) {
659657
* Creates a geo-spatial criterion using a {@literal $maxDistance} operation, for use with {@literal $near} or
660658
* {@literal $nearSphere}.
661659
* <p>
662-
* <strong>NOTE:</strong> The unit of measure for distance may depends on the used coordinate representation
663-
* (legacy vs. geoJson) as well as the target operation.
660+
* <strong>NOTE:</strong> The unit of measure for distance may depends on the used coordinate representation (legacy
661+
* vs. geoJson) as well as the target operation.
664662
*
665663
* @param maxDistance radians or meters
666664
* @return this.
@@ -682,8 +680,8 @@ public Criteria maxDistance(double maxDistance) {
682680
* Creates a geospatial criterion using a {@literal $minDistance} operation, for use with {@literal $near} or
683681
* {@literal $nearSphere}.
684682
* <p>
685-
* <strong>NOTE:</strong> The unit of measure for distance may depends on the used coordinate representation
686-
* (legacy vs. geoJson) as well as the target operation.
683+
* <strong>NOTE:</strong> The unit of measure for distance may depends on the used coordinate representation (legacy
684+
* vs. geoJson) as well as the target operation.
687685
*
688686
* @param minDistance radians or meters
689687
* @return this.

0 commit comments

Comments
 (0)