Skip to content

Commit c0a4bdb

Browse files
committed
Polishing.
Reformat code. See #3853 Original pull request: #3856.
1 parent 673a81a commit c0a4bdb

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ private LinkageDocument(String lookup) {
178178
}
179179

180180
this.documentPointer = org.bson.Document.parse(targetLookup);
181-
this.isSimpleTargetPointer = placeholderMap.size() == 1 && placeholderMap.containsValue("target") && lookup.contains("#target");
181+
this.isSimpleTargetPointer = placeholderMap.size() == 1 && placeholderMap.containsValue("target")
182+
&& lookup.contains("#target");
182183
}
183184

184185
private String placeholder(int index) {
@@ -248,7 +249,7 @@ Object updatePlaceholders(org.bson.Document source, org.bson.Document target,
248249
target.put(entry.getKey(), entry.getValue());
249250
}
250251

251-
if(target.size()==1 && isSimpleTargetPointer) {
252+
if (target.size() == 1 && isSimpleTargetPointer) {
252253
return target.values().iterator().next();
253254
}
254255

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ protected boolean isAssociationConversionNecessary(Field documentField, @Nullabl
517517
return true;
518518
}
519519

520-
if(property.isDocumentReference()) {
520+
if (property.isDocumentReference()) {
521521
return true;
522522
}
523523

@@ -1415,8 +1415,8 @@ protected String mapPropertyName(MongoPersistentProperty property) {
14151415
String partial = iterator.next();
14161416
currentIndex++;
14171417

1418-
boolean isPositional = isPositionalParameter(partial) && property.isCollectionLike() ;
1419-
if(property.isMap() && currentPropertyRoot.equals(partial) && iterator.hasNext()){
1418+
boolean isPositional = isPositionalParameter(partial) && property.isCollectionLike();
1419+
if (property.isMap() && currentPropertyRoot.equals(partial) && iterator.hasNext()) {
14201420
partial = iterator.next();
14211421
currentIndex++;
14221422
}
@@ -1428,7 +1428,7 @@ protected String mapPropertyName(MongoPersistentProperty property) {
14281428
inspect = isPositional && iterator.hasNext();
14291429
}
14301430

1431-
if(currentIndex + 1 < pathParts.size()) {
1431+
if (currentIndex + 1 < pathParts.size()) {
14321432
currentIndex++;
14331433
currentPropertyRoot = pathParts.get(currentIndex);
14341434
}

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/QueryMapperUnitTests.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import org.springframework.data.mongodb.core.query.Criteria;
6363
import org.springframework.data.mongodb.core.query.Query;
6464
import org.springframework.data.mongodb.core.query.TextQuery;
65-
import org.springframework.data.mongodb.core.query.Update;
6665

6766
import com.mongodb.BasicDBObject;
6867
import com.mongodb.MongoClientSettings;
@@ -1557,10 +1556,10 @@ static class WithDocumentReference {
15571556

15581557
private String name;
15591558

1560-
@DocumentReference(lookup = "{ 'name' : ?#{#target} }") // remove `lookup` for the other test case.
1559+
@DocumentReference(lookup = "{ 'name' : ?#{#target} }")
15611560
private Customer customer;
15621561

1563-
@DocumentReference(lookup = "{ 'name' : ?#{#target} }") // remove `lookup` for the other test case.
1562+
@DocumentReference(lookup = "{ 'name' : ?#{#target} }")
15641563
private List<Customer> customers;
15651564

15661565
@DocumentReference

spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/UpdateMapperUnitTests.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
import org.junit.jupiter.api.BeforeEach;
3636
import org.junit.jupiter.api.Test;
3737
import org.junit.jupiter.api.extension.ExtendWith;
38-
import org.mockito.Mock;
3938
import org.mockito.Mockito;
4039
import org.mockito.junit.jupiter.MockitoExtension;
40+
4141
import org.springframework.core.convert.converter.Converter;
4242
import org.springframework.data.annotation.Id;
4343
import org.springframework.data.annotation.Transient;
@@ -47,9 +47,7 @@
4747
import org.springframework.data.domain.Sort.Direction;
4848
import org.springframework.data.domain.Sort.Order;
4949
import org.springframework.data.mapping.MappingException;
50-
import org.springframework.data.mongodb.MongoDatabaseFactory;
5150
import org.springframework.data.mongodb.core.DocumentTestUtils;
52-
import org.springframework.data.mongodb.core.MongoExceptionTranslator;
5351
import org.springframework.data.mongodb.core.mapping.DocumentReference;
5452
import org.springframework.data.mongodb.core.mapping.Field;
5553
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
@@ -1699,10 +1697,10 @@ static class WithDocumentReference {
16991697

17001698
private String name;
17011699

1702-
@DocumentReference(lookup = "{ 'name' : ?#{#target} }") // remove `lookup` for the other test case.
1700+
@DocumentReference(lookup = "{ 'name' : ?#{#target} }")
17031701
private Customer customer;
17041702

1705-
@DocumentReference(lookup = "{ 'name' : ?#{#target} }") // remove `lookup` for the other test case.
1703+
@DocumentReference(lookup = "{ 'name' : ?#{#target} }")
17061704
private List<Customer> customers;
17071705

17081706
@DocumentReference

0 commit comments

Comments
 (0)