- All Known Implementing Classes:
SimpleValueInstantiators,ValueInstantiators.Base
public interface ValueInstantiators
Interface for providers of
ValueInstantiator instances.
Implemented when an object wants to provide custom value instantiators,
usually to support custom value types with alternate constructors, or
which need specified post-processing after construction but before
binding data.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classBasic "NOP" implementation that can be used as the base class for custom implementations. -
Method Summary
Modifier and TypeMethodDescriptionfindValueInstantiator(DeserializationConfig config, BeanDescription.Supplier beanDescRef) Method called to find theValueInstantiatorto use for creating instances of specified type during deserialization.default ValueInstantiatormodifyValueInstantiator(DeserializationConfig config, BeanDescription.Supplier beanDescRef, ValueInstantiator defaultInstantiator) Method called to find theValueInstantiatorto use for creating instances of specified type during deserialization.
-
Method Details
-
findValueInstantiator
ValueInstantiator findValueInstantiator(DeserializationConfig config, BeanDescription.Supplier beanDescRef) Method called to find theValueInstantiatorto use for creating instances of specified type during deserialization.Note that unlike with 2.0, no default instantiator is passed at this point: there is a separate method,
modifyValueInstantiator(tools.jackson.databind.DeserializationConfig, tools.jackson.databind.BeanDescription.Supplier, tools.jackson.databind.deser.ValueInstantiator)if you want to use or modify that.- Parameters:
config- Deserialization configuration in usebeanDescRef- Additional information about POJO type to be instantiated- Returns:
- Instantiator to use if custom one wanted, or
nullto indicate "use default instantiator".
-
modifyValueInstantiator
default ValueInstantiator modifyValueInstantiator(DeserializationConfig config, BeanDescription.Supplier beanDescRef, ValueInstantiator defaultInstantiator) Method called to find theValueInstantiatorto use for creating instances of specified type during deserialization. Note that a default value instantiator is always created first and passed; if an implementation does not want to modify or replace it, it has to return passed instance as is (returning null is an error)- Parameters:
config- Deserialization configuration in usebeanDescRef- Additional information about POJO type to be instantiateddefaultInstantiator- Instantiator that will be used if no changes are made; passed to allow custom instances to use annotation-provided information (note, however, that earlierValueInstantiatorsmay have changed it to a custom instantiator already)- Returns:
- Instantiator to use; either
defaultInstantiatorthat was passed, or a custom variant; cannot be null.
-