Java Reflection Annotation Find findAnnotation(AnnotatedElement annotated, Class annotationClass)

Here you can find the source of findAnnotation(AnnotatedElement annotated, Class annotationClass)

Description

find Annotation

License

Apache License

Declaration

public static <T extends Annotation> T findAnnotation(AnnotatedElement annotated, Class<T> annotationClass) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;

public class Main {
    public static <T extends Annotation> T findAnnotation(AnnotatedElement annotated, Class<T> annotationClass) {
        T ret;/*www  . j a  va 2 s.c o  m*/
        if (annotated == null) {
            ret = null;
        } else {
            ret = annotated.getAnnotation(annotationClass);
        }
        return ret;
    }
}

Related

  1. findAnnotation(AnnotatedElement annotatedElement, Class annotationClass)
  2. findAnnotation(AnnotatedElement annotatedElement, Class annotationType)
  3. findAnnotation(AnnotatedElement element, Class annotationType)
  4. findAnnotation(Annotation parentAnnotation, Class annotationType)