public static Method [ ] getAnnotatedDeclaredMethods ( Class < ? > clazz , Class < ? extends Annotation > annotationClass , boolean recursively ) { Method [ ] allMethods = getDeclaredMethods ( clazz , recursively ) ; List < Method > annotatedMethods = new LinkedList < Method > ( ) ; for ( Method method : allMethods ) { if ( method . isAnnotationPresent ( annotationClass ) ) annotatedMethods . add ( method ) ; } return annotatedMethods . toArray ( new Method [ annotatedMethods . size ( ) ] ) ; }
obtain methods list of specified class and which are annotated by incoming annotation class If recursively is true obtain methods from all class hierarchy