public static < T extends Annotation > T getAnnotation ( Method method , Class < T > annotationClass ) { T t = method . getAnnotation ( annotationClass ) ; if ( t == null ) { t = getAnnotation ( method . getDeclaringClass ( ) , annotationClass ) ; } return t ; }
Extract the annotation from the method or the declaring class .