public static boolean hasNamedAnnotation(AnnotatedConstruct ac, String name) {
    for (AnnotationMirror annotation : ac.getAnnotationMirrors()) {
      if (getName(annotation.getAnnotationType().asElement()).equals(name)) {
        return true;
      }
    }
    return false;
  }
public static boolean hasNamedAnnotation ( AnnotatedConstruct ac , String name ) { for ( AnnotationMirror annotation : ac . getAnnotationMirrors ( ) ) { if ( getName ( annotation . getAnnotationType ( ) . asElement ( ) ) . equals ( name ) ) { return true ; } } return false ; }
Less strict version of the above where we don't care about the annotation's package.