File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
main/java/org/springframework/data/util
test/java/org/springframework/data/util Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -148,6 +148,12 @@ protected TypeInformation<?> doGetComponentType() {
148148 return getTypeArgument (CustomCollections .getMapBaseType (rawType ), 0 );
149149 }
150150
151+ List <TypeInformation <?>> arguments = getTypeArguments ();
152+
153+ if (arguments .size () > 0 ) {
154+ return arguments .get (0 );
155+ }
156+
151157 if (Iterable .class .isAssignableFrom (rawType )) {
152158 return getTypeArgument (Iterable .class , 0 );
153159 }
@@ -156,9 +162,7 @@ protected TypeInformation<?> doGetComponentType() {
156162 return getTypeArgument (rawType , 0 );
157163 }
158164
159- List <TypeInformation <?>> arguments = getTypeArguments ();
160-
161- return arguments .size () > 0 ? arguments .get (0 ) : null ;
165+ return null ;
162166 }
163167
164168 @ Override
Original file line number Diff line number Diff line change 3131import org .mockito .junit .jupiter .MockitoExtension ;
3232import org .springframework .beans .factory .annotation .Autowire ;
3333import org .springframework .core .ResolvableType ;
34+ import org .springframework .data .geo .GeoResults ;
3435import org .springframework .util .ReflectionUtils ;
3536
3637/**
@@ -326,6 +327,14 @@ void detectsMapKeyAndValueOnEnumMaps() {
326327 assertThat (map .getMapValueType ().getType ()).isEqualTo (String .class );
327328 }
328329
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+
329338 class Person {
330339
331340 Addresses addresses ;
@@ -415,4 +424,8 @@ class Leaf {}
415424 class EnumMapWrapper {
416425 EnumMap <Autowire , String > map ;
417426 }
427+
428+ class GeoResultsWrapper {
429+ GeoResults <Leaf > results ;
430+ }
418431}
You can’t perform that action at this time.
0 commit comments