Interface CustomDescribableModel
-
public interface CustomDescribableModel
Allows the usage ofDescribableModel
to be fine-tuned to cover special cases such as backwards compatibility. Implement this interface on aDescriptor
.Normally introspection of a struct class with
DataBoundConstructor
andDataBoundSetter
suffices for databinding. This facility allows the definer of the struct to accept variant inputs toDescribableModel.instantiate(Map)
, or recommend variant outputs forDescribableModel.uninstantiate2(Object)
. This is somewhat analogous to implementing areadResolve
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
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default Map<String,Object>
customInstantiate(Map<String,Object> arguments)
Permits customization of the behavior ofDescribableModel.instantiate(Map)
.default UninstantiatedDescribable
customUninstantiate(UninstantiatedDescribable ud)
Permits customization of the behavior ofDescribableModel.uninstantiate2(Object)
.static CustomDescribableModel
of(Class<?> type)
-
-
-
Method Detail
-
customInstantiate
@NonNull default Map<String,Object> customInstantiate(@NonNull Map<String,Object> arguments)
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
@CheckForNull static CustomDescribableModel of(Class<?> type)
-
-