Code example for AnnotationMirror

Methods: getAnnotationType

0
        return out;
    } 
 
    /** Return true if the given annotation mirror equals the given annotation class */ 
    private static boolean equals(AnnotationMirror annotationMirror, Class<? extends Annotation> annotationClass) {
        return annotationMirror.getAnnotationType().toString().equals(annotationClass.getName());
    } 
 
    public static AnnotationMirror getAnnotation(Element element, Class<? extends Annotation> annotationClass) {
        for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) {
            if (annotationMirror.getAnnotationType().toString().equals(annotationClass.getName())) {
                return annotationMirror;
            } 
        } 
        return null; 
    } 
 
    @SuppressWarnings("unchecked") 
    public static <T> T getAnnotationValue(AnnotationMirror annotationMirror, String key) {
        for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annotationMirror.getElementValues().entrySet()) {