Java Reflection Annotation getAnnotation(Class clazz, Class annClazz)

Here you can find the source of getAnnotation(Class clazz, Class annClazz)

Description

get Annotation

License

Apache License

Declaration

public static <T extends Annotation> T getAnnotation(Class<?> clazz,
            Class<T> annClazz) 

Method Source Code

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

import java.lang.annotation.Annotation;

public class Main {
    public static <T extends Annotation> T getAnnotation(Class<?> clazz,
            Class<T> annClazz) {
        while (clazz != null) {
            T ann = clazz.getAnnotation(annClazz);
            if (ann != null) {
                return ann;
            }//from   www  .  j ava  2  s.  co m
            clazz = clazz.getSuperclass();
        }
        return null;
    }
}

Related

  1. getAnnotation(Class clazz, Class annotationClass)
  2. getAnnotation(Class clazz, Class annotationClass)
  3. getAnnotation(Class clazz, Class annotClass, boolean forceInherit)
  4. getAnnotation(Class clazz, Class annotationClass)
  5. getAnnotation(Class clazz, Class ann)
  6. getAnnotation(Class clazz, Class annotation)
  7. getAnnotation(Class clazz, Class annotation)
  8. getAnnotation(Class clazz, Class annotationClass)
  9. getAnnotation(Class clazz, Class annotationClass)