Method (Class<?> aClass, String methodName, Class<?>[] params) { try { Method method = aClass.getDeclaredMethod(methodName, params); method.setAccessible(true); return method; } catch (NoSuchMethodException ignored) { } Class<?> parent = aClass.getSuperclass(); return parent == null ? null : findMethod(parent, methodName, params); }