mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
Use getMethod instead of traversing the inheritance tree
This is possible since property accessors are always public
This commit is contained in:
parent
92c30bd8f2
commit
d97a447d13
@ -55,15 +55,12 @@ public interface PathBuilderValidator {
|
||||
@Override
|
||||
public boolean validate(Class<?> parent, String property, Class<?> propertyType) {
|
||||
String accessor = "get" + BeanUtils.capitalize(property);
|
||||
while (!parent.equals(Object.class)) {
|
||||
try {
|
||||
parent.getDeclaredMethod(accessor);
|
||||
return true;
|
||||
} catch (NoSuchMethodException e) {
|
||||
parent = parent.getSuperclass();
|
||||
}
|
||||
try {
|
||||
parent.getMethod(accessor);
|
||||
return true;
|
||||
} catch (NoSuchMethodException e) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user