Checks if a method has an annotation.

@param element The method
@param ann    The annotation to look for
@return Whether if the method has the annotation
770313
@Override
    public boolean hasAnnotation(Element element, Class<? extends Annotation> ann) {
        List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
        for (AnnotationMirror annotationMirror : annotationMirrors) {
            if (annotationMirror.getAnnotationType().toString().equals(ann.getName())) {
                return true;
            }
        }
        return false;
    }
934578
public static boolean hasAnnotation(final ClassNode classNode, final Class<? extends Annotation> annotationClass) {
        return !classNode.getAnnotations(new ClassNode(annotationClass)).isEmpty();
    }
231655
public static boolean hasAnnotation(AnnotatedNode node, String name) {
        return AstUtil.getAnnotation(node, name) != null;
    }
853836
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;
	}
7390
private static <A extends Annotation> A getAnnotation(AnnotatedElement element, Class<A> annotationClass) {
        return (element != null) ? element.getAnnotation(annotationClass) : null;
    }
1028602
public boolean removeAnnotationInfo(final String annotationClassName) {
        
        final AnnotationInfo existInfo = getAnnotationInfo(annotationClassName);
        if(existInfo != null) {
            this.annotationInfos.remove(existInfo);
            return true;
        }
        
        return false;
        
    }
1147173
@Override
    public void visitAnnotation(Annotations arg0) {
        for (AnnotationEntry ae : arg0.getAnnotationEntries()) {
            boolean runtimeVisible = ae.isRuntimeVisible();
            String name = ClassName.fromFieldSignature(ae.getAnnotationType());
            if (name == null) {
                continue;
            }
            name = ClassName.toDottedClassName(name);
            Map<String, ElementValue> map = new HashMap<>();
            for (ElementValuePair ev : ae.getElementValuePairs()) {
                map.put(ev.getNameString(), ev.getValue());
            }
            visitAnnotation(name, map, runtimeVisible);

        }

    }
96528
public static boolean isInAnnotation(Env<?> env, JCTree tree) {
        TreePath tp = TreePath.getPath(env.toplevel, tree);
        if (tp != null) {
            for (Tree t : tp) {
                if (t.getKind() == Tree.Kind.ANNOTATION)
                    return true;
            }
        }
        return false;
    }
107030
public static boolean isAnnotationPresent(final Class<? extends Annotation> annotation, final Method method) {
        final Annotation e = DaemonScanner.getAnnotation(annotation, method);
        return e != null;
    }
247799
public static boolean hasAnnotation(ExecutableElement method, Class<? extends Annotation> ann) {
        List<? extends AnnotationMirror> annotationMirrors = method.getAnnotationMirrors();
        for (AnnotationMirror annotationMirror : annotationMirrors) {
            if (annotationMirror.getAnnotationType().toString().equals(ann.getName())) {
                return true;
            }
        }
        return false;
    }
548733
public static <T extends Annotation> Predicate<T> annotationAnnotatedWith(Class<? extends Annotation>
            annotationClass, boolean includeMetaAnnotations) {
        return candidate -> elementAnnotatedWith(annotationClass, includeMetaAnnotations)
                .test(candidate.annotationType());
    }
164485
public function isClassAnnotatedWith($className, $annotationClassName)
    {
        if (!$this->initialized) {
            $this->initialize();
        }
        $className = $this->cleanClassName($className);

        $annotationClassName = $this->cleanClassName($annotationClassName);

        return (isset($this->annotatedClasses[$annotationClassName][$className]));
    }
248154
public AnnotationMetadata getAnnotationMetadata(Element element) {
        AnnotationMetadata metadata = annotationMetadataCache.get(element);
        if (metadata == null) {
            metadata = newAnnotationBuilder().build(element);
            annotationMetadataCache.put(element, metadata);
        }
        return metadata;
    }
167553
public static <T extends AnnotationDescription> ElementMatcher.Junction<T> is(Annotation annotation) {
        return is(AnnotationDescription.ForLoadedAnnotation.of(annotation));
    }
287908
public boolean hasDeclaredMethodAnnotation(final String methodAnnotationName) {
        for (final MethodInfo mi : getDeclaredMethodInfo()) {
            if (mi.hasAnnotation(methodAnnotationName)) {
                return true;
            }
        }
        return false;
    }
1052434
public static boolean hasNamedAnnotation(AnnotatedConstruct ac, Pattern pattern) {
    for (AnnotationMirror annotation : ac.getAnnotationMirrors()) {
      if (pattern.matcher(getName(annotation.getAnnotationType().asElement())).matches()) {
        return true;
      }
    }
    return false;
  }
473215
private static boolean checkAnnotation(AnnotationsAttribute invisible, AnnotationsAttribute visible,
            String annotationName) {
        boolean exist1 = false;
        boolean exist2 = false;
        if (invisible != null) {
            exist1 = invisible.getAnnotation(annotationName) != null;
        }
        if (visible != null) {
            exist2 = visible.getAnnotation(annotationName) != null;
        }
        return exist1 || exist2;
    }