File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed
main/java/org/springframework/data/util
test/java/org/springframework/data/util Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -198,9 +198,37 @@ private TypeInformation<?> getPropertyInformation(String fieldname) {
198
198
return createInfo (field .getGenericType ());
199
199
}
200
200
201
+ PropertyDescriptor descriptor = findPropertyDescriptor (type , fieldname );
202
+ return descriptor == null ? null : createInfo (getGenericType (descriptor ));
203
+ }
204
+
205
+ /**
206
+ * Finds the {@link PropertyDescriptor} for the property with the given name on the given type.
207
+ *
208
+ * @param type must not be {@literal null}.
209
+ * @param fieldname must not be {@literal null} or empty.
210
+ * @return
211
+ */
212
+ private static PropertyDescriptor findPropertyDescriptor (Class <?> type , String fieldname ) {
213
+
201
214
PropertyDescriptor descriptor = BeanUtils .getPropertyDescriptor (type , fieldname );
202
215
203
- return descriptor == null ? null : createInfo (getGenericType (descriptor ));
216
+ if (descriptor != null ) {
217
+ return descriptor ;
218
+ }
219
+
220
+ List <Class <?>> superTypes = new ArrayList <Class <?>>();
221
+ superTypes .addAll (Arrays .asList (type .getInterfaces ()));
222
+ superTypes .add (type .getSuperclass ());
223
+
224
+ for (Class <?> interfaceType : type .getInterfaces ()) {
225
+ descriptor = findPropertyDescriptor (interfaceType , fieldname );
226
+ if (descriptor != null ) {
227
+ return descriptor ;
228
+ }
229
+ }
230
+
231
+ return null ;
204
232
}
205
233
206
234
/**
Original file line number Diff line number Diff line change @@ -394,8 +394,11 @@ interface Product {
394
394
Category getCategory ();
395
395
}
396
396
397
- interface Category {
397
+ interface Category extends Identifiable {
398
398
399
+ }
400
+
401
+ interface Identifiable {
399
402
Long getId ();
400
403
}
401
404
}
You can’t perform that action at this time.
0 commit comments