static < T extends Annotation > T findAnnotation ( Method method , Class < T > clazz ) { T annotation = AnnotationUtils . findAnnotation ( method , clazz ) ; if ( annotation == null ) { try { annotation = AnnotationUtils . findAnnotation ( method . getDeclaringClass ( ) . getMethod ( method . getName ( ) , method . getParameterTypes ( ) ) , clazz ) ; } catch ( NoSuchMethodException | SecurityException ex ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Exception occurred while tyring to find the annotation" , ex ) ; } } } return annotation ; }
Searches for an annotation either on a method or inside the method parameters .