Annotation Type RequestObject


  • @Retention(RUNTIME)
    @Target({METHOD,PARAMETER,CONSTRUCTOR,FIELD})
    public @interface RequestObject
    Specifies which element should be converted by RequestConverterFunction.

    A RequestObject can be implicitly applied when:

    • A parameter is neither annotated nor automatically injected type in an annotated method.
    • A RequestConverter annotation is specified on a parameter in an annotated method or a setter of a bean.
    • A RequestConverter annotation is specified on a field of a bean.
    • A RequestConverter annotation is specified on a method or constructor which has only one parameter.
    The following example shows when to apply a RequestObject implicitly.
    
     > @RequestConverter(ErinConverter.class)
     > @RequestConverter(FrankConverter.class)
     > public class CompositeBean {
     >     private final Alice a;
     >
     >     @RequestConverter(BobConverter.class)      // @RequestObject would be applied implicitly.
     >     private Bob b;
     >
     >     private Charlie c;
     >     private David d;
     >     private Erin e;
     >
     >     @RequestObject
     >     private Frank f;                           // Would be converted by the class-level converter.
     >
     >     private String g;                          // No conversion would be performed. 'null' would be set.
     >
     >     @RequestConverter(AliceConverter.class)    // @RequestObject would be applied implicitly.
     >     public CompositeBean(Alice a) { ... }
     >
     >     @RequestConverter(CharlieConverter.class)  // @RequestObject would be applied implicitly.
     >     public void setCharlie(Charlie c) { ... }
     >
     >     // @RequestObject would be applied implicitly.
     >     public void setDavidAndErin(@RequestConverter(DavidConverter.class) David d, Erin e) { ... }
     > }
     
    See Also:
    RequestConverterFunction, RequestConverter