40
40
import org .springframework .util .ReflectionUtils ;
41
41
42
42
/**
43
+ * Basic {@link TypeDiscoverer} that contains basic functionality to discover property types.
44
+ *
45
+ * @author Oliver Gierke
43
46
* @author Christoph Strobl
44
- * @since 2021/11
47
+ * @author Mark Paluch
45
48
*/
46
49
public class TypeDiscoverer <S > implements TypeInformation <S > {
47
50
@@ -135,7 +138,6 @@ private Optional<TypeInformation<?>> getPropertyInformation(String fieldname) {
135
138
136
139
if (it .getReadMethod () != null ) {
137
140
return new TypeDiscoverer (ResolvableType .forMethodReturnType (it .getReadMethod (), rawType ));
138
- // return ClassTypeInformation.fromReturnTypeOf(it.getReadMethod());
139
141
}
140
142
if (it .getWriteMethod () != null ) {
141
143
return new TypeDiscoverer (ResolvableType .forMethodParameter (it .getWriteMethod (), 0 , rawType ));
@@ -222,20 +224,6 @@ protected TypeInformation<?> doGetComponentType() {
222
224
}
223
225
224
226
return mapValueType .resolve () != null ? new TypeDiscoverer <>(mapValueType ) :null ;
225
-
226
- // return Arrays.stream(resolvableType.getInterfaces()).filter(ResolvableType::hasGenerics)
227
- // .findFirst()
228
- // .map(it -> it.getGeneric(0))
229
- // .filter(it -> !ResolvableType.NONE.equals(it))
230
- // .map(NewTypeDiscoverer::new)
231
- // .orElse(null);
232
-
233
- // if(type.getComponentType().equals(ResolvableType.NONE)) {
234
- // if(!type.hasGenerics()) {
235
- // return null;
236
- // }
237
- // }
238
- // return mapValueType != null ? new NewTypeDiscoverer(mapValueType) : new ClassTypeInformation<>(Object.class);
239
227
}
240
228
241
229
if (isNullableWrapper ()) {
@@ -377,8 +365,6 @@ public TypeInformation<?> getSuperTypeInformation(Class<?> superType) {
377
365
candidates .add (genericSuperclass );
378
366
}
379
367
380
- // todo try raw type interfaces //
381
-
382
368
candidates .addAll (Arrays .asList (resolvableType .getInterfaces ()));
383
369
384
370
for (var candidate : candidates ) {
@@ -393,12 +379,7 @@ public TypeInformation<?> getSuperTypeInformation(Class<?> superType) {
393
379
return new TypeDiscoverer <>(ResolvableType .forRawClass (superType ));
394
380
}
395
381
}
396
- // return new NewTypeDiscoverer<>(ResolvableType.forClassWithGenerics(candidate.toClass(), classes));
397
382
}
398
- // return new NewTypeDiscoverer(candidate);
399
- // if(ObjectUtils.isEmpty(superType.getTypeParameters())) {
400
- // new NewTypeDiscoverer(ResolvableType.forRawClass(superType));
401
- // }
402
383
return new TypeDiscoverer (ResolvableType .forClass (superType , getType ()));
403
384
} else {
404
385
var sup = candidate .getSuperType ();
0 commit comments