java.lang.Object
tools.jackson.databind.deser.ValueDeserializerModifier
- All Implemented Interfaces:
Serializable
Abstract class that defines API for objects that can be registered
(via
ObjectMapper configuration process,
using MapperBuilder)
to participate in constructing ValueDeserializer instances
(including but not limited to BeanDeserializers).
This is typically done by modules that want alter some aspects of
the typical serialization process.
Sequence in which callback methods are called for a BeanDeserializer is:
updateProperties(tools.jackson.databind.DeserializationConfig, tools.jackson.databind.BeanDescription.Supplier, java.util.List<tools.jackson.databind.introspect.BeanPropertyDefinition>)is called once all property definitions are collected, and initial filtering (by ignorable type and explicit ignoral-by-bean) has been performed.updateBuilder(tools.jackson.databind.DeserializationConfig, tools.jackson.databind.BeanDescription.Supplier, tools.jackson.databind.deser.BeanDeserializerBuilder)is called once all initial pieces for building deserializer have been collectedmodifyDeserializer(tools.jackson.databind.DeserializationConfig, tools.jackson.databind.BeanDescription.Supplier, tools.jackson.databind.ValueDeserializer<?>)is called after deserializer has been built byBeanDeserializerBuilderbut before it is returned to be used
For other types of deserializers, methods called depend on type of values for
which deserializer is being constructed; and only a single method is called
since the process does not involve builders (unlike that of BeanDeserializer.
Default method implementations are "no-op"s, meaning that methods are implemented but have no effect; this is mostly so that new methods can be added in later versions.
NOTE: In Jackson 2.x was named BeanDeserializerModifier
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmodifyArrayDeserializer(DeserializationConfig config, ArrayType valueType, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byDeserializerFactoryafter it has constructed the standard deserializer for givenArrayTypeto make it possible to either replace or augment this deserializer with additional functionality.modifyCollectionDeserializer(DeserializationConfig config, CollectionType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultCollectionTypedeserializer instance.modifyCollectionLikeDeserializer(DeserializationConfig config, CollectionLikeType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultCollectionLikeTypedeserializer instance.modifyDeserializer(DeserializationConfig config, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing default bean deserializer instance with properties collected and ordered earlier.modifyEnumDeserializer(DeserializationConfig config, JavaType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing default enum type deserializer instance.modifyKeyDeserializer(DeserializationConfig config, JavaType type, KeyDeserializer deserializer) Method called byDeserializerFactoryafter it has constructed the standard key deserializer for given key type.modifyMapDeserializer(DeserializationConfig config, MapType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultMapTypedeserializer instance.modifyMapLikeDeserializer(DeserializationConfig config, MapLikeType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultMapLikeTypedeserializer instance.modifyReferenceDeserializer(DeserializationConfig config, ReferenceType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultReferenceTypedeserializer instance.updateBuilder(DeserializationConfig config, BeanDescription.Supplier beanDescRef, BeanDeserializerBuilder builder) Method called byBeanDeserializerFactorywhen it has collected basic information such as tentative list of properties to deserialize.updateProperties(DeserializationConfig config, BeanDescription.Supplier beanDescRef, List<BeanPropertyDefinition> propDefs) Method called byBeanDeserializerFactorywhen it has collected initial list ofBeanPropertyDefinitions, and done basic by-name and by-type filtering, but before constructing builder or actual property handlers; or arranging order.
-
Constructor Details
-
ValueDeserializerModifier
public ValueDeserializerModifier()
-
-
Method Details
-
updateProperties
public List<BeanPropertyDefinition> updateProperties(DeserializationConfig config, BeanDescription.Supplier beanDescRef, List<BeanPropertyDefinition> propDefs) Method called byBeanDeserializerFactorywhen it has collected initial list ofBeanPropertyDefinitions, and done basic by-name and by-type filtering, but before constructing builder or actual property handlers; or arranging order. The most common changes to make at this point are to completely remove specified properties, or rename then: other modifications are easier to make at later points. -
updateBuilder
public BeanDeserializerBuilder updateBuilder(DeserializationConfig config, BeanDescription.Supplier beanDescRef, BeanDeserializerBuilder builder) Method called byBeanDeserializerFactorywhen it has collected basic information such as tentative list of properties to deserialize. Implementations may choose to modify state of builder (to affect deserializer being built), or even completely replace it (if they want to build different kind of deserializer). Typically changes mostly concern set of properties to deserialize. -
modifyDeserializer
public ValueDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing default bean deserializer instance with properties collected and ordered earlier. Implementations can modify or replace given deserializer and return deserializer to use. Note that although initial deserializer being passed is usually of typeBeanDeserializer, modifiers may return deserializers of other types; and this is why implementations must check for type before casting.Since 2.10 this is also called for custom deserializers for types not deemed to be of any more specific (reference, enum, array, collection(-like), map(-like), node type)
-
modifyEnumDeserializer
public ValueDeserializer<?> modifyEnumDeserializer(DeserializationConfig config, JavaType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing default enum type deserializer instance. -
modifyReferenceDeserializer
public ValueDeserializer<?> modifyReferenceDeserializer(DeserializationConfig config, ReferenceType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultReferenceTypedeserializer instance. -
modifyArrayDeserializer
public ValueDeserializer<?> modifyArrayDeserializer(DeserializationConfig config, ArrayType valueType, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byDeserializerFactoryafter it has constructed the standard deserializer for givenArrayTypeto make it possible to either replace or augment this deserializer with additional functionality.- Parameters:
config- Configuration in usevalueType- Type of the value deserializer is used for.beanDescRef- Description of the type to deserializedeserializer- Default deserializer that would be used.- Returns:
- Deserializer to use; either
deserializerthat was passed in, or an instance method constructed.
-
modifyCollectionDeserializer
public ValueDeserializer<?> modifyCollectionDeserializer(DeserializationConfig config, CollectionType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultCollectionTypedeserializer instance. -
modifyCollectionLikeDeserializer
public ValueDeserializer<?> modifyCollectionLikeDeserializer(DeserializationConfig config, CollectionLikeType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultCollectionLikeTypedeserializer instance. -
modifyMapDeserializer
public ValueDeserializer<?> modifyMapDeserializer(DeserializationConfig config, MapType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultMapTypedeserializer instance. -
modifyMapLikeDeserializer
public ValueDeserializer<?> modifyMapLikeDeserializer(DeserializationConfig config, MapLikeType type, BeanDescription.Supplier beanDescRef, ValueDeserializer<?> deserializer) Method called byBeanDeserializerFactoryafter constructing defaultMapLikeTypedeserializer instance. -
modifyKeyDeserializer
public KeyDeserializer modifyKeyDeserializer(DeserializationConfig config, JavaType type, KeyDeserializer deserializer) Method called byDeserializerFactoryafter it has constructed the standard key deserializer for given key type. This make it possible to replace the default key deserializer, or augment it somehow (including optional use of default deserializer with occasional override).
-