Code example for AnnotationMirror

Methods: getAnnotationType

0
	 * @return {@code true} if the provided annotation type is of the same type as the provided class, {@code false} otherwise. 
	 */ 
	public static boolean isAnnotationMirrorOfType(AnnotationMirror annotationMirror, String fqcn) {
		assert annotationMirror != null;
		assert fqcn != null;
		String annotationClassName = annotationMirror.getAnnotationType().toString();
 
		return annotationClassName.equals( fqcn );
	} 
 
	/** 
	 * Checks whether the {@code Element} hosts the annotation with the given fully qualified class name. 
	 * 
	 * @param element the element to check for the hosted annotation 
	 * @param fqcn the fully qualified class name of the annotation to check for 
	 * 
	 * @return the annotation mirror for the specified annotation class from the {@code Element} or {@code null} in case 
	 *         the {@code TypeElement} does not host the specified annotation. 
	 */ 
	public static AnnotationMirror getAnnotationMirror(Element element, String fqcn) {
Experience pair programming with AI  Get Codota for Java