Annotation Interface ParameterAnnotation


@Target(ANNOTATION_TYPE) @Retention(RUNTIME) public @interface ParameterAnnotation

Mark an annotation as provider for parameter annotations to be copied to the adder/setter methods. The target annotation must be settable on methods and/or fields.

If the target annotation is placed on a (virtual) field, all annotation members of that annotation with target type ElementType.PARAMETER will be placed on the value parameter of the generated DSL methods.


 @interface MyAnnotation {
     MyParamAnnotation value()
 }
 @DSL class Foo {

   @MyAnnotation(@MyParamAnnotation("text"))
   String field

 }
 

Will have the setter method generated as follows:


 String field(@MyParamAnnotation("text") String value)
 

Note that any default values of target annotation will currently not be copied over.

Since this is especially useful for Closure fields and the {@literal @DelegatesTo}/{@literal @ClosureParams} annotations, for this case the annotation ParameterAnnotation.ClosureHint is provided containing members for both annotations.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Allows a DelegatesTo and or ClosureParams annotation to be placed on the element parameter for adder methods (in case of collection or map only on the single adder methods).