get Annotation from Annotated Element - Java java.lang.annotation

Java examples for java.lang.annotation:Annotation Element

Description

get Annotation from Annotated Element

Demo Code


//package com.java2s;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;

public class Main {
    public static Annotation getAnnotation(AnnotatedElement element,
            Class<? extends Annotation> annotation) {
        return element.getAnnotation(annotation);
    }//  w  w  w.ja v a2s.co  m
}

Related Tutorials