Browse Source

Polishing.

Reformat code.

See #3847
Original pull request: #3848.
pull/3856/head
Mark Paluch 4 years ago
parent
commit
c7263e5b11
No known key found for this signature in database
GPG Key ID: 4406B84C1661DCD1
  1. 12
      spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/DocumentPointerFactory.java

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

@ -91,8 +91,10 @@ class DocumentPointerFactory {
if (idProperty.hasExplicitWriteTarget() if (idProperty.hasExplicitWriteTarget()
&& conversionService.canConvert(idValue.getClass(), idProperty.getFieldType())) { && conversionService.canConvert(idValue.getClass(), idProperty.getFieldType())) {
return () -> conversionService.convert(idValue, idProperty.getFieldType()); return () -> conversionService.convert(idValue, idProperty.getFieldType());
} else if (idValue instanceof String && ObjectId.isValid((String)idValue)) { }
return () -> new ObjectId((String)idValue);
if (idValue instanceof String && ObjectId.isValid((String) idValue)) {
return () -> new ObjectId((String) idValue);
} }
return () -> idValue; return () -> idValue;
@ -127,15 +129,15 @@ class DocumentPointerFactory {
/** /**
* Value object that computes a document pointer from a given lookup query by identifying SpEL expressions and * Value object that computes a document pointer from a given lookup query by identifying SpEL expressions and
* inverting it. * inverting it.
* *
* <pre class="code"> * <pre class="code">
* // source * // source
* { 'firstname' : ?#{fn}, 'lastname' : '?#{ln} } * { 'firstname' : ?#{fn}, 'lastname' : '?#{ln} }
* *
* // target * // target
* { 'fn' : ..., 'ln' : ... } * { 'fn' : ..., 'ln' : ... }
* </pre> * </pre>
* *
* The actual pointer is the computed via * The actual pointer is the computed via
* {@link #getDocumentPointer(MappingContext, MongoPersistentEntity, PersistentPropertyAccessor)} applying values from * {@link #getDocumentPointer(MappingContext, MongoPersistentEntity, PersistentPropertyAccessor)} applying values from
* the provided {@link PersistentPropertyAccessor} to the target document by looking at the keys of the expressions * the provided {@link PersistentPropertyAccessor} to the target document by looking at the keys of the expressions

Loading…
Cancel
Save