Java Reflection Annotation Find findAnnotationSuperClasses(Class annotationClass, Class c)

Here you can find the source of findAnnotationSuperClasses(Class annotationClass, Class c)

Description

find Annotation Super Classes

License

Apache License

Declaration

public static Annotation findAnnotationSuperClasses(Class<?> annotationClass, Class c) 

Method Source Code


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

import java.lang.annotation.Annotation;

public class Main {
    public static Annotation findAnnotationSuperClasses(Class<?> annotationClass, Class c) {
        while (c != null) {
            Annotation result = c.getAnnotation(annotationClass);
            if (result != null)
                return result;
            else//from w  w  w.j a v  a 2s  .  c o m
                c = c.getSuperclass();
        }
        return null;
    }
}

Related

  1. findAnnotationInAnnotations(AnnotatedElement annotatedElement, Class annotationClass)
  2. findAnnotationInAnyParameter(Method method, Class annotationClass)
  3. findAnnotationInMethodOrInItsAnnotations(Method method, Class annotationClass)
  4. findAnnotationMethods(String fullClassName, Class anno)
  5. findAnnotationsMap(Class a, Class c)
  6. findAnnotationWithMetaAnnotation(Class clazz, Class metaAnnotationType)