Interface AnnotationFactory

    • Method Detail

      • newInstance

        static <T> T newInstance​(Class<? extends T> clazz)
      • getAnnotatedAnnotation

        static <T extends Annotation> Optional<Annotation> getAnnotatedAnnotation​(AnnotatedElement element,
                                                                                  Class<T> targetAnnotation)
        Returns any annotation instance on the annotated element which is itself annotated with the target annotation. For example, given the annotation and class:
         @Retention(RetentionPolicy.RUNTIME)
         @Target(ElementType.ANNOTATION_TYPE)
         public @interface MyAnnotation {
        
             String value();
        
         }
         
         @MyAnnotation("hello")
         public class MyClass {
             
         }
         
        Then getAnnotatedAnnotation(MyClass.class, MyAnnotation.class).value() will return "hello".