Annotation Type DataBoundSetter


  • @Retention(RUNTIME)
    @Target({METHOD,FIELD})
    @Documented
    public @interface DataBoundSetter
    Designates a setter method or a field used to databind JSON values into objects in methods like StaplerRequest.bindJSON(Class, JSONObject) and StaplerRequest.bindParameters(Class, String).

    Stapler will first invoke DataBoundConstructor-annotated constructor, and if there's any remaining properties in JSON, it'll try to find a matching DataBoundSetter-annotated setter method or a field.

    The setter method is discovered through Introspector, so setter method name must match the property name (such as setFoo for the foo property), and it needs to be public.

    The field is discovered through simple reflection, so its name must match the property name, but its access modifier can be anything.

    To create a method to be called after all the setter injections are complete, annotate a method with PostConstruct.

    Author:
    Kohsuke Kawaguchi