vendredi 8 mai 2020

Is there any way to obtain all super annotations on a class?

For example:

@SubAnnotation
public class Test {
    public static void main(String args[]){
        Annotation[] annotations = Test.class.getAnnotations();
        for(Annotation annot: annotations){
            System.out.println(annot);
        }
    }
}

@Retention(RetentionPolicy.RUNTIME)
@SuperAnnotation
public @interface SubAnnotation {
}

How to obtain SuperAnnotation on Test.class?





Aucun commentaire:

Enregistrer un commentaire