Package org.kohsuke.stapler
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 likeStaplerRequest.bindJSON(Class, JSONObject)
andStaplerRequest.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 matchingDataBoundSetter
-annotated setter method or a field.The setter method is discovered through
Introspector
, so setter method name must match the property name (such assetFoo
for thefoo
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