Interface CustomDescribableModel
DescribableModel
to be fine-tuned to cover special cases such as backwards compatibility.
Implement this interface on a Descriptor
.
Normally introspection of a struct class with DataBoundConstructor
and DataBoundSetter
suffices for databinding.
This facility allows the definer of the struct to accept variant inputs to DescribableModel.instantiate(Map)
,
or recommend variant outputs for DescribableModel.uninstantiate2(Object)
.
This is somewhat analogous to implementing a readResolve
method to customize XStream serialization behavior.
These are relatively high-level (syntactic) transformations,
including details such as UninstantiatedDescribable.ANONYMOUS_KEY
vs. DescribableModel.CLAZZ
.
On the one hand, that allows implementations precise control over behavior.
On the other hand, it means that implementations must sometimes take care
to handle several surface variants of the same underlying data model.
Only those methods explicitly indicated are customized by this interface,
so for example DescribableModel.getSoleRequiredParameter()
will continue to be determined
entirely by Java reflection.
Furthermore, only those use cases (such as Pipeline and some modes of Job DSL)
which run inside the Jenkins controller and use the indicated methods will honor customizations made in this way;
in particular, the Configuration as Code plugin currently will not,
and anything that relies on inspection of bytecode from an external process cannot.
Therefore it is best to limit usage of this API to preserving compatibility
or otherwise adjusting behavior in ways that cannot be done otherwise.
Arguments passed to customization methods are immutable. If you wish to make changes, create and return a copy of the argument.
-
Method Summary
Modifier and TypeMethodDescriptioncustomInstantiate
(Map<String, Object> arguments) Permits customization of the behavior ofDescribableModel.instantiate(Map)
.default UninstantiatedDescribable
Permits customization of the behavior ofDescribableModel.uninstantiate2(Object)
.static CustomDescribableModel
-
Method Details
-
customInstantiate
Permits customization of the behavior ofDescribableModel.instantiate(Map)
. -
customUninstantiate
@NonNull default UninstantiatedDescribable customUninstantiate(@NonNull UninstantiatedDescribable ud) Permits customization of the behavior ofDescribableModel.uninstantiate2(Object)
. -
of
-