2121import java .util .Collection ;
2222import java .util .Collections ;
2323import java .util .LinkedHashSet ;
24- import java .util .List ;
2524import java .util .Map ;
2625import java .util .Optional ;
2726import java .util .Set ;
2827import java .util .function .Supplier ;
2928
30- import org .springframework .core .GenericTypeResolver ;
3129import org .springframework .data .mapping .Association ;
3230import org .springframework .data .mapping .PersistentEntity ;
3331import org .springframework .data .mapping .PersistentProperty ;
3432import org .springframework .data .util .Lazy ;
33+ import org .springframework .data .util .NullableWrapperConverters ;
3534import org .springframework .data .util .ReflectionUtils ;
3635import org .springframework .data .util .TypeInformation ;
3736import org .springframework .lang .Nullable ;
@@ -94,18 +93,17 @@ public AbstractPersistentProperty(Property property, PersistentEntity<?, P> owne
9493 this .usePropertyAccess = Lazy .of (() -> owner .getType ().isInterface () || CAUSE_FIELD .equals (getField ()));
9594
9695 this .isAssociation = Lazy .of (() -> ASSOCIATION_TYPE != null && ASSOCIATION_TYPE .isAssignableFrom (rawType ));
97- this .associationTargetType = ASSOCIATION_TYPE == null
98- ? Lazy .empty ()
99- : Lazy .of (() -> Optional .of (getTypeInformation ())
100- .map (it -> it .getSuperTypeInformation (ASSOCIATION_TYPE ))
101- .map (TypeInformation ::getComponentType )
96+ this .associationTargetType = ASSOCIATION_TYPE == null //
97+ ? Lazy .empty () //
98+ : Lazy .of (() -> Optional .of (getTypeInformation ()) //
99+ .map (it -> it .getSuperTypeInformation (ASSOCIATION_TYPE )) //
100+ .map (TypeInformation ::getComponentType ) //
102101 .orElse (null ));
103102
104103 this .entityTypeInformation = Lazy .of (() -> Optional .ofNullable (getAssociationOrActualType ())
105104 .filter (it -> !simpleTypeHolder .isSimpleType (it .getType ())) //
106105 .filter (it -> !it .isCollectionLike ()) //
107- .filter (it -> !it .isMap ())
108- .orElse (null ));
106+ .filter (it -> !it .isMap ()).orElse (null ));
109107
110108 this .getter = property .getGetter ().orElse (null );
111109 this .setter = property .getSetter ().orElse (null );
@@ -121,32 +119,34 @@ public AbstractPersistentProperty(Property property, PersistentEntity<?, P> owne
121119 this .entityTypes = Lazy .of (() -> collectEntityTypes (simpleTypeHolder , information , new LinkedHashSet <>()));
122120 }
123121
124- protected Set <TypeInformation <?>> collectEntityTypes (SimpleTypeHolder simpleTypeHolder , @ Nullable TypeInformation <?> typeInformation , Set <TypeInformation <?>> entityTypes ) {
122+ protected Set <TypeInformation <?>> collectEntityTypes (SimpleTypeHolder simpleTypeHolder ,
123+ @ Nullable TypeInformation <?> typeInformation , Set <TypeInformation <?>> entityTypes ) {
125124
126- if (typeInformation == null || entityTypes .contains (typeInformation ) || simpleTypeHolder .isSimpleType (typeInformation .getType ())) {
125+ if (typeInformation == null || entityTypes .contains (typeInformation )
126+ || simpleTypeHolder .isSimpleType (typeInformation .getType ())) {
127127 return entityTypes ;
128128 }
129129
130- if (typeInformation .isMap ()) {
130+ if (typeInformation .isMap ()) {
131131
132132 collectEntityTypes (simpleTypeHolder , typeInformation .getComponentType (), entityTypes );
133133 collectEntityTypes (simpleTypeHolder , typeInformation .getMapValueType (), entityTypes );
134134 return entityTypes ;
135135 }
136136
137- if (typeInformation .isCollectionLike ()) {
137+ if (typeInformation .isCollectionLike ()) {
138138
139139 collectEntityTypes (simpleTypeHolder , typeInformation .getComponentType (), entityTypes );
140140 return entityTypes ;
141141 }
142142
143- if ( typeInformation .isNullableWrapper ( )) {
143+ if ( NullableWrapperConverters . supports ( typeInformation .getType () )) {
144144
145145 collectEntityTypes (simpleTypeHolder , typeInformation .getActualType (), entityTypes );
146146 return entityTypes ;
147147 }
148148
149- if (ASSOCIATION_TYPE != null && ASSOCIATION_TYPE .isAssignableFrom (typeInformation .getType ())) {
149+ if (ASSOCIATION_TYPE != null && ASSOCIATION_TYPE .isAssignableFrom (typeInformation .getType ())) {
150150
151151 entityTypes .add (getAssociationOrActualType ());
152152 return entityTypes ;
@@ -210,7 +210,7 @@ public TypeInformation<?> getTypeInformation() {
210210 @ Override
211211 public Iterable <? extends TypeInformation <?>> getPersistentEntityTypes () {
212212
213- if (isMap () || isCollectionLike ()) {
213+ if (isMap () || isCollectionLike ()) {
214214 return entityTypes .get ();
215215 }
216216
0 commit comments