@@ -381,10 +381,10 @@ protected Map<Object, Object> readMap(final TypeInformation<?> type, final Couch
381
381
}
382
382
383
383
TypeInformation <?> valueType = type .getMapValueType ();
384
- if (value instanceof CouchbaseDocument ) {
385
- map .put (key , read (valueType , ( CouchbaseDocument ) value , parent ));
386
- } else if (value instanceof CouchbaseList ) {
387
- map .put (key , readCollection (valueType , ( CouchbaseList ) value , parent ));
384
+ if (value instanceof CouchbaseDocument couchbaseDocument ) {
385
+ map .put (key , read (valueType , couchbaseDocument , parent ));
386
+ } else if (value instanceof CouchbaseList couchbaseList ) {
387
+ map .put (key , readCollection (valueType , couchbaseList , parent ));
388
388
} else {
389
389
Class <?> valueClass = valueType == null ? null : valueType .getType ();
390
390
map .put (key , getPotentiallyConvertedSimpleRead (value , valueClass ));
@@ -511,8 +511,8 @@ protected void copyCouchbaseDocument(final CouchbaseDocument source, final Couch
511
511
}
512
512
513
513
private String convertToString (Object propertyObj ) {
514
- if (propertyObj instanceof String ) {
515
- return ( String ) propertyObj ;
514
+ if (propertyObj instanceof String str ) {
515
+ return str ;
516
516
} else if (propertyObj instanceof Number ) {
517
517
return new StringBuffer ().append (propertyObj ).toString ();
518
518
} else {
@@ -821,10 +821,10 @@ private Object readCollection(final TypeInformation<?> targetType, final Couchba
821
821
822
822
Object dbObjItem = source .get (i );
823
823
824
- if (dbObjItem instanceof CouchbaseDocument ) {
825
- items .add (read (componentType , ( CouchbaseDocument ) dbObjItem , parent ));
826
- } else if (dbObjItem instanceof CouchbaseList ) {
827
- items .add (readCollection (componentType != null ? componentType :TypeInformation .of (dbObjItem .getClass ()), ( CouchbaseList ) dbObjItem , parent ));
824
+ if (dbObjItem instanceof CouchbaseDocument couchbaseDocument ) {
825
+ items .add (read (componentType , couchbaseDocument , parent ));
826
+ } else if (dbObjItem instanceof CouchbaseList couchbaseList ) {
827
+ items .add (readCollection (componentType != null ? componentType :TypeInformation .of (dbObjItem .getClass ()), couchbaseList , parent ));
828
828
} else {
829
829
items .add (getPotentiallyConvertedSimpleRead (dbObjItem , rawComponentType ));
830
830
}
@@ -915,8 +915,8 @@ public void setApplicationContext(ApplicationContext applicationContext) {
915
915
setEntityCallbacks (EntityCallbacks .create (applicationContext ));
916
916
}
917
917
ClassLoader classLoader = applicationContext .getClassLoader ();
918
- if (this .typeMapper instanceof BeanClassLoaderAware && classLoader != null ) {
919
- (( BeanClassLoaderAware ) this . typeMapper ) .setBeanClassLoader (classLoader );
918
+ if (this .typeMapper instanceof BeanClassLoaderAware beanClassLoaderAware && classLoader != null ) {
919
+ beanClassLoaderAware .setBeanClassLoader (classLoader );
920
920
}
921
921
}
922
922
@@ -949,10 +949,10 @@ private <R> R readValue(Object value, TypeInformation type, Object parent) {
949
949
950
950
if (conversions .hasCustomReadTarget (value .getClass (), rawType )) {
951
951
return (R ) conversionService .convert (value , rawType );
952
- } else if (value instanceof CouchbaseDocument ) {
953
- return (R ) read (type , ( CouchbaseDocument ) value , parent );
954
- } else if (value instanceof CouchbaseList ) {
955
- return (R ) readCollection (type , ( CouchbaseList ) value , parent );
952
+ } else if (value instanceof CouchbaseDocument couchbaseDocument ) {
953
+ return (R ) read (type , couchbaseDocument , parent );
954
+ } else if (value instanceof CouchbaseList couchbaseList ) {
955
+ return (R ) readCollection (type , couchbaseList , parent );
956
956
} else {
957
957
return (R ) getPotentiallyConvertedSimpleRead (value , type .getType ()); // type does not have annotations
958
958
}
@@ -982,11 +982,11 @@ public <R> R readValue(Object value, CouchbasePersistentProperty prop, Object pa
982
982
TypeInformation ti = TypeInformation .of (value .getClass ());
983
983
return (R ) conversionService .convert (value , ti .toTypeDescriptor (), new TypeDescriptor (prop .getField ()));
984
984
}
985
- if (value instanceof CouchbaseDocument ) {
986
- return (R ) read (prop .getTypeInformation (), ( CouchbaseDocument ) value , parent );
985
+ if (value instanceof CouchbaseDocument couchbaseDocument ) {
986
+ return (R ) read (prop .getTypeInformation (), couchbaseDocument , parent );
987
987
}
988
- if (value instanceof CouchbaseList ) {
989
- return (R ) readCollection (prop .getTypeInformation (), ( CouchbaseList ) value , parent );
988
+ if (value instanceof CouchbaseList couchbaseList ) {
989
+ return (R ) readCollection (prop .getTypeInformation (), couchbaseList , parent );
990
990
}
991
991
return (R ) getPotentiallyConvertedSimpleRead (value , prop );// passes PersistentProperty with annotations
992
992
0 commit comments