in src/main/java/org/apache/commons/beanutils2/MappedPropertyDescriptor.java [214:246]
private static Method internalGetMethod(final Class<?> initial, final String methodName, final int parameterCount) {
// For overridden methods we need to find the most derived version.
// So we start with the given class and walk up the superclass chain.
for (Class<?> clazz = initial; clazz != null; clazz = clazz.getSuperclass()) {
final Method[] methods = clazz.getDeclaredMethods();
for (final Method method : methods) {
if (method == null) {
continue;
}
// skip static methods.
final int mods = method.getModifiers();
if (!Modifier.isPublic(mods) || Modifier.isStatic(mods)) {
continue;
}
if (method.getName().equals(methodName) && method.getParameterTypes().length == parameterCount) {
return method;
}
}
}
// Now check any inherited interfaces. This is necessary both when
// the argument class is itself an interface, and when the argument
// class is an abstract class.
final Class<?>[] interfaces = initial.getInterfaces();
for (final Class<?> interface1 : interfaces) {
final Method method = internalGetMethod(interface1, methodName, parameterCount);
if (method != null) {
return method;
}
}
return null;
}