Annotation Type AutoAnnotation


  • @Retention(CLASS)
    @Target(METHOD)
    public @interface AutoAnnotation
    Annotation that causes an implementation of an annotation interface to be generated. The annotation is applied to a method whose return type is an annotation interface. The method can then create and return an instance of the generated class that conforms to the specification of Annotation, in particular as regards equals and hashCode. These instances behave essentially the same as instances returned by AnnotatedElement.getAnnotation(java.lang.Class<T>).

    For example, suppose you have an annotation like this:

    
     package com.google.inject.name;
    
     public @interface Named {
       String value();
     }
     

    You could write a method like this to construct implementations of the interface:

    {@code
     package com.example;
    
     public class Names {
    Author:
    emcmanus@google.com (Éamonn McManus)