public static List < Method > methodsOf ( Class < ? > type ) { if ( type == null ) { throw new IllegalArgumentException ( "Method argument type must not be null" ) ; } List < Method > methods = new LinkedList <> ( ) ; Queue < Class < ? > > classes = new LinkedList <> ( ) ; classes . add ( type ) ; while ( ! classes . isEmpty ( ) ) { Class < ? > c = classes . poll ( ) ; methods . addAll ( asList ( c . getDeclaredMethods ( ) ) ) ; if ( c . getSuperclass ( ) != null ) { classes . add ( c . getSuperclass ( ) ) ; } addAll ( classes , c . getInterfaces ( ) ) ; } return methods ; }
All methods of the given type its super types and interfaces starting with the methods of the given type .