public static Method getDeclaredMethod ( Class < ? > clazz , boolean recursively , String methodName , Class < ? > ... parameterTypes ) { try { return clazz . getDeclaredMethod ( methodName , parameterTypes ) ; } catch ( NoSuchMethodException e ) { Class < ? > superClass = clazz . getSuperclass ( ) ; if ( superClass != null && recursively ) { return getDeclaredMethod ( superClass , true , methodName , parameterTypes ) ; } } catch ( SecurityException e ) { log . error ( "{}" , e . getMessage ( ) , e ) ; } return null ; }
obtain method list of specified class If recursively is true obtain method from all class hierarchy