public static boolean isAnnotationPresent(Element element, String annotationName) {
    return getAnnotationMirror(element, annotationName).isPresent();
  }
Returns {@code true} iff the given element has an {@link AnnotationMirror} whose {@linkplain
AnnotationMirror#getAnnotationType() annotation type} has {@code annotationName} as its
canonical name. This method is a safer alternative to calling {@link Element#getAnnotation} and
checking for {@code null} as it avoids any interaction with annotation proxies.
common/src/main/java/com/google/auto/common/MoreElements.java