@@ -141,7 +141,6 @@ public MappingMongoConverter(DbRefResolver dbRefResolver,
141
141
this ::getWriteTarget );
142
142
this .idMapper = new QueryMapper (this );
143
143
144
-
145
144
this .spELContext = new SpELContext (DocumentPropertyAccessor .INSTANCE );
146
145
this .dbRefProxyHandler = new DefaultDbRefProxyHandler (spELContext , mappingContext ,
147
146
(prop , bson , evaluator , path ) -> {
@@ -161,8 +160,8 @@ protected ConversionContext getConversionContext(ObjectPath path) {
161
160
162
161
Assert .notNull (path , "ObjectPath must not be null" );
163
162
164
- return new ConversionContext (conversions , path , this ::readDocument , this ::readCollectionOrArray , this ::readMap , this :: readDBRef ,
165
- this ::getPotentiallyConvertedSimpleRead );
163
+ return new ConversionContext (conversions , path , this ::readDocument , this ::readCollectionOrArray , this ::readMap ,
164
+ this ::readDBRef , this :: getPotentiallyConvertedSimpleRead );
166
165
}
167
166
168
167
/**
@@ -376,8 +375,7 @@ private <S extends Object> S read(ConversionContext context, MongoPersistentEnti
376
375
}
377
376
378
377
private <S > S populateProperties (ConversionContext context , MongoPersistentEntity <S > entity ,
379
- DocumentAccessor documentAccessor ,
380
- SpELExpressionEvaluator evaluator , S instance ) {
378
+ DocumentAccessor documentAccessor , SpELExpressionEvaluator evaluator , S instance ) {
381
379
382
380
PersistentPropertyAccessor <S > accessor = new ConvertingPropertyAccessor <>(entity .getPropertyAccessor (instance ),
383
381
conversionService );
@@ -423,8 +421,7 @@ private Object readAndPopulateIdentifier(ConversionContext context, PersistentPr
423
421
424
422
@ Nullable
425
423
private Object readIdValue (ConversionContext context , SpELExpressionEvaluator evaluator ,
426
- MongoPersistentProperty idProperty ,
427
- Object rawId ) {
424
+ MongoPersistentProperty idProperty , Object rawId ) {
428
425
429
426
String expression = idProperty .getSpelExpression ();
430
427
Object resolvedValue = expression != null ? evaluator .evaluate (expression ) : rawId ;
@@ -434,8 +431,7 @@ private Object readIdValue(ConversionContext context, SpELExpressionEvaluator ev
434
431
435
432
private void readProperties (ConversionContext context , MongoPersistentEntity <?> entity ,
436
433
PersistentPropertyAccessor <?> accessor , DocumentAccessor documentAccessor ,
437
- MongoDbPropertyValueProvider valueProvider ,
438
- SpELExpressionEvaluator evaluator ) {
434
+ MongoDbPropertyValueProvider valueProvider , SpELExpressionEvaluator evaluator ) {
439
435
440
436
DbRefResolverCallback callback = null ;
441
437
@@ -505,8 +501,7 @@ private void readAssociation(Association<MongoPersistentProperty> association, P
505
501
506
502
@ Nullable
507
503
private Object readUnwrapped (ConversionContext context , DocumentAccessor documentAccessor ,
508
- MongoPersistentProperty prop ,
509
- MongoPersistentEntity <?> unwrappedEntity ) {
504
+ MongoPersistentProperty prop , MongoPersistentEntity <?> unwrappedEntity ) {
510
505
511
506
if (prop .findAnnotation (Unwrapped .class ).onEmpty ().equals (OnEmpty .USE_EMPTY )) {
512
507
return read (context , unwrappedEntity , (Document ) documentAccessor .getDocument ());
@@ -1447,8 +1442,7 @@ private <T> List<T> bulkReadAndConvertDBRefs(ConversionContext context, List<DBR
1447
1442
T target = null ;
1448
1443
if (document != null ) {
1449
1444
1450
- maybeEmitEvent (
1451
- new AfterLoadEvent <>(document , (Class <T >) type .getType (), collectionName ));
1445
+ maybeEmitEvent (new AfterLoadEvent <>(document , (Class <T >) type .getType (), collectionName ));
1452
1446
target = (T ) readDocument (context , document , type );
1453
1447
}
1454
1448
@@ -1541,9 +1535,10 @@ private <T extends Object> T doConvert(Object value, Class<? extends T> target)
1541
1535
}
1542
1536
1543
1537
@ SuppressWarnings ("ConstantConditions" )
1544
- private <T extends Object > T doConvert (Object value , Class <? extends T > target , @ Nullable Class <? extends T > fallback ) {
1538
+ private <T extends Object > T doConvert (Object value , Class <? extends T > target ,
1539
+ @ Nullable Class <? extends T > fallback ) {
1545
1540
1546
- if (conversionService .canConvert (value .getClass (), target ) || fallback == null ) {
1541
+ if (conversionService .canConvert (value .getClass (), target ) || fallback == null ) {
1547
1542
return conversionService .convert (value , target );
1548
1543
}
1549
1544
return conversionService .convert (value , fallback );
@@ -1861,9 +1856,10 @@ protected static class ConversionContext {
1861
1856
private final ContainerValueConverter <DBRef > dbRefConverter ;
1862
1857
private final ValueConverter <Object > elementConverter ;
1863
1858
1864
- ConversionContext (org .springframework .data .convert .CustomConversions customConversions , ObjectPath path , ContainerValueConverter <Bson > documentConverter ,
1865
- ContainerValueConverter <Collection <?>> collectionConverter , ContainerValueConverter <Bson > mapConverter ,
1866
- ContainerValueConverter <DBRef > dbRefConverter , ValueConverter <Object > elementConverter ) {
1859
+ ConversionContext (org .springframework .data .convert .CustomConversions customConversions , ObjectPath path ,
1860
+ ContainerValueConverter <Bson > documentConverter , ContainerValueConverter <Collection <?>> collectionConverter ,
1861
+ ContainerValueConverter <Bson > mapConverter , ContainerValueConverter <DBRef > dbRefConverter ,
1862
+ ValueConverter <Object > elementConverter ) {
1867
1863
1868
1864
this .conversions = customConversions ;
1869
1865
this .path = path ;
@@ -1935,8 +1931,8 @@ public ConversionContext withPath(ObjectPath currentPath) {
1935
1931
1936
1932
Assert .notNull (currentPath , "ObjectPath must not be null" );
1937
1933
1938
- return new ConversionContext (conversions , currentPath , documentConverter , collectionConverter , mapConverter , dbRefConverter ,
1939
- elementConverter );
1934
+ return new ConversionContext (conversions , currentPath , documentConverter , collectionConverter , mapConverter ,
1935
+ dbRefConverter , elementConverter );
1940
1936
}
1941
1937
1942
1938
public ObjectPath getPath () {
0 commit comments