public static Method findMethod ( Class < ? > objClass , String methodName , Class < ? > [ ] parameterTypes ) throws NoSuchMethodException { try { return objClass . getDeclaredMethod ( methodName , parameterTypes ) ; } catch ( NoSuchMethodException e ) { if ( Object . class . equals ( objClass ) ) throw e ; try { // try super return findMethod ( objClass . getSuperclass ( ) , methodName , parameterTypes ) ; } catch ( NoSuchMethodException parentException ) { throw e ; } } }
Find the method for a target of its parent