public static List < Method > getAllDeclaredMethods ( Class < ? > clazz ) { List < Method > result = new ArrayList <> ( ) ; while ( clazz != null ) { Method [ ] methods = clazz . getDeclaredMethods ( ) ; Collections . addAll ( result , methods ) ; clazz = clazz . getSuperclass ( ) ; } return result ; }
Returns all declared methods of a class including methods of superclasses .