private static List < Method > getAnnotatedMethodsFromChildToParent ( Class < ? > clazz , Class < ? extends Annotation > annotation , Logger log ) { List < Method > methodsToRun = new ArrayList < Method > ( ) ; while ( clazz != null ) { List < Method > newMethods = getMethodsWithAnnotation ( clazz , annotation , log ) ; for ( Method newMethod : newMethods ) { if ( containsMethod ( newMethod , methodsToRun ) ) { removeMethodByName ( newMethod , methodsToRun ) ; } else { methodsToRun . add ( newMethod ) ; } } clazz = clazz . getSuperclass ( ) ; if ( clazz != null && clazz . equals ( Object . class ) ) { clazz = null ; } } return methodsToRun ; }
Locates all annotated methods on the type passed in sorted as declared from the type to its super class .