File tree 2 files changed +20
-3
lines changed
main/java/org/springframework/data/util
test/java/org/springframework/data/util
2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,12 @@ protected TypeInformation<?> doGetComponentType() {
148
148
return getTypeArgument (CustomCollections .getMapBaseType (rawType ), 0 );
149
149
}
150
150
151
+ List <TypeInformation <?>> arguments = getTypeArguments ();
152
+
153
+ if (arguments .size () > 0 ) {
154
+ return arguments .get (0 );
155
+ }
156
+
151
157
if (Iterable .class .isAssignableFrom (rawType )) {
152
158
return getTypeArgument (Iterable .class , 0 );
153
159
}
@@ -156,9 +162,7 @@ protected TypeInformation<?> doGetComponentType() {
156
162
return getTypeArgument (rawType , 0 );
157
163
}
158
164
159
- List <TypeInformation <?>> arguments = getTypeArguments ();
160
-
161
- return arguments .size () > 0 ? arguments .get (0 ) : null ;
165
+ return null ;
162
166
}
163
167
164
168
@ Override
Original file line number Diff line number Diff line change 31
31
import org .mockito .junit .jupiter .MockitoExtension ;
32
32
import org .springframework .beans .factory .annotation .Autowire ;
33
33
import org .springframework .core .ResolvableType ;
34
+ import org .springframework .data .geo .GeoResults ;
34
35
import org .springframework .util .ReflectionUtils ;
35
36
36
37
/**
@@ -326,6 +327,14 @@ void detectsMapKeyAndValueOnEnumMaps() {
326
327
assertThat (map .getMapValueType ().getType ()).isEqualTo (String .class );
327
328
}
328
329
330
+ @ Test
331
+ void detectsComponentTypeOfTypedClass () {
332
+
333
+ TypeInformation <?> property = TypeInformation .of (GeoResultsWrapper .class ).getProperty ("results" );
334
+
335
+ assertThat (property .getComponentType ().getType ()).isEqualTo (Leaf .class );
336
+ }
337
+
329
338
class Person {
330
339
331
340
Addresses addresses ;
@@ -415,4 +424,8 @@ class Leaf {}
415
424
class EnumMapWrapper {
416
425
EnumMap <Autowire , String > map ;
417
426
}
427
+
428
+ class GeoResultsWrapper {
429
+ GeoResults <Leaf > results ;
430
+ }
418
431
}
You can’t perform that action at this time.
0 commit comments