public static boolean hasAnnotation ( AnnotatedElement elem , Class < ? extends Annotation > annotationType , boolean checkMetaAnnotations ) { if ( elem . isAnnotationPresent ( annotationType ) ) { return true ; } if ( checkMetaAnnotations ) { for ( Annotation a : elem . getAnnotations ( ) ) { for ( Annotation meta : a . annotationType ( ) . getAnnotations ( ) ) { if ( meta . annotationType ( ) . getName ( ) . equals ( annotationType . getName ( ) ) ) { return true ; } } } } return false ; }
Checks if a Class or Method are annotated with the given annotation