@@ -128,34 +128,37 @@ private static Stream<MethodParameter> extractFrom(Class<?> clazz, String fieldN
128
128
* @return the stream
129
129
*/
130
130
private static Stream <MethodParameter > fromGetterOfField (Class <?> paramClass , Field field , String fieldNamePrefix ) {
131
- if (isSimpleType (field .getType ()))
131
+ Class <?> type = extractType (paramClass , field );
132
+
133
+ if (Objects .isNull (type ))
134
+ return Stream .empty ();
135
+
136
+ if (isSimpleType (type ))
132
137
return fromSimpleClass (paramClass , field , fieldNamePrefix );
133
- else if ( field . getGenericType () instanceof TypeVariable <?>)
134
- return extractTypeParameter ( paramClass , ( TypeVariable <?>) field .getGenericType (), field , fieldNamePrefix ) ;
135
- else
136
- return extractFrom ( field . getType (), fieldNamePrefix + field . getName () + DOT );
138
+ else {
139
+ String prefix = fieldNamePrefix + field .getName () + DOT ;
140
+ return extractFrom ( type , prefix );
141
+ }
137
142
}
138
143
139
144
/**
140
- * Extract type parameter stream.
141
- *
142
- * @param owningClass the owning class
143
- * @param genericType the generic type
144
- * @param field the field
145
- * @param fieldNamePrefix the field name prefix
146
- * @return the stream
145
+ * Extract the type
146
+ * @param paramClass
147
+ * @param field
148
+ * @return The revoled type or null if it was not a reifiable type
147
149
*/
148
- private static Stream < MethodParameter > extractTypeParameter (
149
- Class <?> owningClass ,
150
- TypeVariable <?> genericType ,
151
- Field field ,
152
- String fieldNamePrefix ) {
153
-
154
- Type resolvedType = ReturnTypeParser . resolveType ( genericType , owningClass ) ;
155
- if ( resolvedType instanceof Class <?> && isSimpleType (( Class <?>) resolvedType )) {
156
- return fromSimpleClass ( owningClass , field , fieldNamePrefix ) ;
150
+ private static Class <?> extractType ( Class <?> paramClass , Field field ) {
151
+ Class <?> type = field . getType ();
152
+ if ( field . getGenericType () instanceof TypeVariable <?>) {
153
+ Type fieldType = ReturnTypeParser . resolveType ( field . getGenericType (), paramClass );
154
+
155
+ if ( fieldType instanceof Class <?>)
156
+ type = ( Class <?>) fieldType ;
157
+ else // This is the case for not reifiable types
158
+ type = null ;
157
159
}
158
- return Stream .empty ();
160
+
161
+ return type ;
159
162
}
160
163
161
164
/**
0 commit comments