Class BeanDeserializerModifier
- java.lang.Object
-
- com.fasterxml.jackson.databind.deser.BeanDeserializerModifier
-
public abstract class BeanDeserializerModifier extends java.lang.Object
Abstract class that defines API for objects that can be registered to participate in constructingJsonDeserializer
instances (viaDeserializerFactory
). This is typically done by modules that want alter some aspects of deserialization process; and is preferable to sub-classing ofBeanDeserializerFactory
.Note that Jackson 2.2 adds more methods for customization; with earlier versions only
BeanDeserializer
instances could be modified, but with 2.2 all types of deserializers can be changed.Sequence in which callback methods are called for
BeanDeserializer
is:updateProperties(com.fasterxml.jackson.databind.DeserializationConfig, com.fasterxml.jackson.databind.BeanDescription, java.util.List<com.fasterxml.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(com.fasterxml.jackson.databind.DeserializationConfig, com.fasterxml.jackson.databind.BeanDescription, com.fasterxml.jackson.databind.deser.BeanDeserializerBuilder)
is called once all initial pieces for building deserializer have been collectedmodifyDeserializer(com.fasterxml.jackson.databind.DeserializationConfig, com.fasterxml.jackson.databind.BeanDescription, com.fasterxml.jackson.databind.JsonDeserializer<?>)
is called after deserializer has been built byBeanDeserializerBuilder
but 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.
-
-
Constructor Summary
Constructors Constructor Description BeanDeserializerModifier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonDeserializer<?>
modifyArrayDeserializer(DeserializationConfig config, ArrayType valueType, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byDeserializerFactory
after it has constructed the standard deserializer for givenArrayType
to make it possible to either replace or augment this deserializer with additional functionality.JsonDeserializer<?>
modifyCollectionDeserializer(DeserializationConfig config, CollectionType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultCollectionType
deserializer instance.JsonDeserializer<?>
modifyCollectionLikeDeserializer(DeserializationConfig config, CollectionLikeType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultCollectionLikeType
deserializer instance.JsonDeserializer<?>
modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing default bean deserializer instance with properties collected and ordered earlier.JsonDeserializer<?>
modifyEnumDeserializer(DeserializationConfig config, JavaType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing default enum type deserializer instance.KeyDeserializer
modifyKeyDeserializer(DeserializationConfig config, JavaType type, KeyDeserializer deserializer)
Method called byDeserializerFactory
after it has constructed the standard key deserializer for given key type.JsonDeserializer<?>
modifyMapDeserializer(DeserializationConfig config, MapType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultMapType
deserializer instance.JsonDeserializer<?>
modifyMapLikeDeserializer(DeserializationConfig config, MapLikeType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultMapLikeType
deserializer instance.JsonDeserializer<?>
modifyReferenceDeserializer(DeserializationConfig config, ReferenceType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultReferenceType
deserializer instance.BeanDeserializerBuilder
updateBuilder(DeserializationConfig config, BeanDescription beanDesc, BeanDeserializerBuilder builder)
Method called byBeanDeserializerFactory
when it has collected basic information such as tentative list of properties to deserialize.java.util.List<BeanPropertyDefinition>
updateProperties(DeserializationConfig config, BeanDescription beanDesc, java.util.List<BeanPropertyDefinition> propDefs)
Method called byBeanDeserializerFactory
when it has collected initial list ofBeanPropertyDefinition
s, and done basic by-name and by-type filtering, but before constructing builder or actual property handlers; or arranging order.
-
-
-
Method Detail
-
updateProperties
public java.util.List<BeanPropertyDefinition> updateProperties(DeserializationConfig config, BeanDescription beanDesc, java.util.List<BeanPropertyDefinition> propDefs)
Method called byBeanDeserializerFactory
when it has collected initial list ofBeanPropertyDefinition
s, 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 beanDesc, BeanDeserializerBuilder builder)
Method called byBeanDeserializerFactory
when 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 JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after 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 JsonDeserializer<?> modifyEnumDeserializer(DeserializationConfig config, JavaType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing default enum type deserializer instance.- Since:
- 2.2
-
modifyReferenceDeserializer
public JsonDeserializer<?> modifyReferenceDeserializer(DeserializationConfig config, ReferenceType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultReferenceType
deserializer instance.- Since:
- 2.7
-
modifyArrayDeserializer
public JsonDeserializer<?> modifyArrayDeserializer(DeserializationConfig config, ArrayType valueType, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byDeserializerFactory
after it has constructed the standard deserializer for givenArrayType
to 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.beanDesc
- Description fdeserializer
- Default deserializer that would be used.- Returns:
- Deserializer to use; either
deserializer
that was passed in, or an instance method constructed. - Since:
- 2.2
-
modifyCollectionDeserializer
public JsonDeserializer<?> modifyCollectionDeserializer(DeserializationConfig config, CollectionType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultCollectionType
deserializer instance.- Since:
- 2.2
-
modifyCollectionLikeDeserializer
public JsonDeserializer<?> modifyCollectionLikeDeserializer(DeserializationConfig config, CollectionLikeType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultCollectionLikeType
deserializer instance.- Since:
- 2.2
-
modifyMapDeserializer
public JsonDeserializer<?> modifyMapDeserializer(DeserializationConfig config, MapType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultMapType
deserializer instance.- Since:
- 2.2
-
modifyMapLikeDeserializer
public JsonDeserializer<?> modifyMapLikeDeserializer(DeserializationConfig config, MapLikeType type, BeanDescription beanDesc, JsonDeserializer<?> deserializer)
Method called byBeanDeserializerFactory
after constructing defaultMapLikeType
deserializer instance.- Since:
- 2.2
-
modifyKeyDeserializer
public KeyDeserializer modifyKeyDeserializer(DeserializationConfig config, JavaType type, KeyDeserializer deserializer)
Method called byDeserializerFactory
after 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).- Since:
- 2.2
-
-