public static List < Method > getAllMethodsShallow ( Class < ? > c , Class < ? extends Annotation > annotationType ) { List < Method > annotated = new ArrayList <> ( ) ; for ( Method m : c . getDeclaredMethods ( ) ) { if ( m . isAnnotationPresent ( annotationType ) ) annotated . add ( m ) ; } return annotated ; }
Returns a set of Methods that contain the given method annotation . This includes all public protected package and private methods but not those of superclasses and interfaces .