Class BeanDeserializerFactory
- java.lang.Object
-
- com.fasterxml.jackson.databind.deser.DeserializerFactory
-
- com.fasterxml.jackson.databind.deser.BasicDeserializerFactory
-
- com.fasterxml.jackson.databind.deser.BeanDeserializerFactory
-
- All Implemented Interfaces:
java.io.Serializable
public class BeanDeserializerFactory extends BasicDeserializerFactory implements java.io.Serializable
Concrete deserializer factory class that adds full Bean deserializer construction logic using class introspection. Note that factories specifically do not implement any form of caching: aside from configuration they are stateless; caching is implemented by other components.Instances of this class are fully immutable as all configuration is done by using "fluent factories" (methods that construct new factory instances with different configuration, instead of modifying instance).
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.deser.BasicDeserializerFactory
BasicDeserializerFactory.ContainerDefaultMappings, BasicDeserializerFactory.CreatorCollectionState
-
-
Field Summary
Fields Modifier and Type Field Description static BeanDeserializerFactory
instance
Globally shareable thread-safe instance which has no additional custom deserializers registered-
Fields inherited from class com.fasterxml.jackson.databind.deser.BasicDeserializerFactory
_factoryConfig, UNWRAPPED_CREATOR_PARAM_NAME
-
Fields inherited from class com.fasterxml.jackson.databind.deser.DeserializerFactory
NO_DESERIALIZERS
-
-
Constructor Summary
Constructors Constructor Description BeanDeserializerFactory(DeserializerFactoryConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected JsonDeserializer<java.lang.Object>
_findUnsupportedTypeDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc)
Helper method called to see if given type, otherwise to be taken as POJO type, is "known but not supported" JDK type, and if so, return alternate handler (deserializer).protected void
_validateSubType(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc)
protected void
addBackReferenceProperties(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder)
Method that will find if bean has any managed- or back-reference properties, and if so add them to bean, to be linked during resolution phase.protected void
addBeanProps(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder)
Method called to figure out settable properties for the bean deserializer to use.protected void
addInjectables(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder)
Method called locate all members used for value injection (if any), constructorValueInjector
instances, and add them to builder.protected void
addObjectIdReader(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder)
protected void
addReferenceProperties(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder)
Deprecated.JsonDeserializer<java.lang.Object>
buildBeanDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc)
Method that is to actually build a bean deserializer instance.protected JsonDeserializer<java.lang.Object>
buildBuilderBasedDeserializer(DeserializationContext ctxt, JavaType valueType, BeanDescription builderDesc)
Method for constructing a bean deserializer that uses specified intermediate Builder for binding data, and construction of the value instance.JsonDeserializer<java.lang.Object>
buildThrowableDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc)
protected SettableAnyProperty
constructAnySetter(DeserializationContext ctxt, BeanDescription beanDesc, AnnotatedMember mutator)
Method called to construct fallbackSettableAnyProperty
for handling unknown bean properties, given a method that has been designated as such setter.protected BeanDeserializerBuilder
constructBeanDeserializerBuilder(DeserializationContext ctxt, BeanDescription beanDesc)
Overridable method that constructs aBeanDeserializerBuilder
which is used to accumulate information needed to create deserializer instance.protected SettableBeanProperty
constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0)
Method that will construct a regular bean property setter using the given setter method.protected SettableBeanProperty
constructSetterlessProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef)
Method that will construct a regular bean property setter using the given setter method.JsonDeserializer<java.lang.Object>
createBeanDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc)
Method thatDeserializerCache
s call to create a new deserializer for types other than Collections, Maps, arrays and enums.JsonDeserializer<java.lang.Object>
createBuilderBasedDeserializer(DeserializationContext ctxt, JavaType valueType, BeanDescription valueBeanDesc, java.lang.Class<?> builderClass)
Method called to create a deserializer that will use specified Builder class for building value instances.protected java.util.List<BeanPropertyDefinition>
filterBeanProps(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder, java.util.List<BeanPropertyDefinition> propDefsIn, java.util.Set<java.lang.String> ignored)
Deprecated.in 2.12, remove from 3.0protected java.util.List<BeanPropertyDefinition>
filterBeanProps(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder, java.util.List<BeanPropertyDefinition> propDefsIn, java.util.Set<java.lang.String> ignored, java.util.Set<java.lang.String> included)
Helper method called to filter out explicit ignored properties, as well as properties that have "ignorable types".protected JsonDeserializer<?>
findStdDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc)
Method called byBeanDeserializerFactory
to see if there might be a standard deserializer registered for given type.protected boolean
isIgnorableType(DeserializationConfig config, BeanPropertyDefinition propDef, java.lang.Class<?> type, java.util.Map<java.lang.Class<?>,java.lang.Boolean> ignoredTypes)
Helper method that will check whether given raw type is marked as always ignorable (for purpose of ignoring properties with type)protected boolean
isPotentialBeanType(java.lang.Class<?> type)
Helper method used to skip processing for types that we know cannot be (i.e.protected JavaType
materializeAbstractType(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc)
DeserializerFactory
withConfig(DeserializerFactoryConfig config)
Method used by module registration functionality, to construct a new bean deserializer factory with different configuration settings.-
Methods inherited from class com.fasterxml.jackson.databind.deser.BasicDeserializerFactory
_addExplicitAnyCreator, _addExplicitAnyCreator, _addExplicitConstructorCreators, _addExplicitDelegatingCreator, _addExplicitFactoryCreators, _addExplicitPropertyCreator, _addImplicitConstructorCreators, _addImplicitFactoryCreators, _addRecordConstructor, _constructDefaultValueInstantiator, _findCreatorsFromProperties, _findCustomArrayDeserializer, _findCustomBeanDeserializer, _findCustomCollectionDeserializer, _findCustomCollectionLikeDeserializer, _findCustomEnumDeserializer, _findCustomMapDeserializer, _findCustomMapLikeDeserializer, _findCustomReferenceDeserializer, _findCustomTreeNodeDeserializer, _findJsonValueFor, _findRemappedType, _getSetterInfo, _handleSingleArgumentCreator, _hasCreatorAnnotation, _mapAbstractCollectionType, _mapAbstractMapType, _reportUnwrappedCreatorProperty, _validateNamedPropertyParameter, _valueInstantiatorInstance, constructCreatorProperty, constructEnumResolver, createArrayDeserializer, createCollectionDeserializer, createCollectionLikeDeserializer, createEnumDeserializer, createKeyDeserializer, createMapDeserializer, createMapLikeDeserializer, createReferenceDeserializer, createTreeDeserializer, findContentDeserializerFromAnnotation, findDefaultDeserializer, findDeserializerFromAnnotation, findKeyDeserializerFromAnnotation, findOptionalStdDeserializer, findPropertyContentTypeDeserializer, findPropertyTypeDeserializer, findTypeDeserializer, findValueInstantiator, getFactoryConfig, hasExplicitDeserializerFor, mapAbstractType, modifyTypeByAnnotation, resolveMemberAndTypeAnnotations, resolveType, withAbstractTypeResolver, withAdditionalDeserializers, withAdditionalKeyDeserializers, withDeserializerModifier, withValueInstantiators
-
-
-
-
Field Detail
-
instance
public static final BeanDeserializerFactory instance
Globally shareable thread-safe instance which has no additional custom deserializers registered
-
-
Constructor Detail
-
BeanDeserializerFactory
public BeanDeserializerFactory(DeserializerFactoryConfig config)
-
-
Method Detail
-
withConfig
public DeserializerFactory withConfig(DeserializerFactoryConfig config)
Method used by module registration functionality, to construct a new bean deserializer factory with different configuration settings.- Specified by:
withConfig
in classBasicDeserializerFactory
-
createBeanDeserializer
public JsonDeserializer<java.lang.Object> createBeanDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException
Method thatDeserializerCache
s call to create a new deserializer for types other than Collections, Maps, arrays and enums.- Specified by:
createBeanDeserializer
in classDeserializerFactory
type
- Type to be deserialized- Throws:
JsonMappingException
-
createBuilderBasedDeserializer
public JsonDeserializer<java.lang.Object> createBuilderBasedDeserializer(DeserializationContext ctxt, JavaType valueType, BeanDescription valueBeanDesc, java.lang.Class<?> builderClass) throws JsonMappingException
Description copied from class:DeserializerFactory
Method called to create a deserializer that will use specified Builder class for building value instances.- Specified by:
createBuilderBasedDeserializer
in classDeserializerFactory
- Throws:
JsonMappingException
-
findStdDeserializer
protected JsonDeserializer<?> findStdDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException
Method called byBeanDeserializerFactory
to see if there might be a standard deserializer registered for given type.- Throws:
JsonMappingException
-
_findUnsupportedTypeDeserializer
protected JsonDeserializer<java.lang.Object> _findUnsupportedTypeDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException
Helper method called to see if given type, otherwise to be taken as POJO type, is "known but not supported" JDK type, and if so, return alternate handler (deserializer). Initially added to support more meaningful error messages when "Java 8 date/time" support module not registered.- Throws:
JsonMappingException
- Since:
- 2.12
-
materializeAbstractType
protected JavaType materializeAbstractType(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException
- Throws:
JsonMappingException
-
buildBeanDeserializer
public JsonDeserializer<java.lang.Object> buildBeanDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException
Method that is to actually build a bean deserializer instance. All basic sanity checks have been done to know that what we have may be a valid bean type, and that there are no default simple deserializers.- Throws:
JsonMappingException
-
buildBuilderBasedDeserializer
protected JsonDeserializer<java.lang.Object> buildBuilderBasedDeserializer(DeserializationContext ctxt, JavaType valueType, BeanDescription builderDesc) throws JsonMappingException
Method for constructing a bean deserializer that uses specified intermediate Builder for binding data, and construction of the value instance. Note that implementation is mostly copied from the regular BeanDeserializer build method.- Throws:
JsonMappingException
-
addObjectIdReader
protected void addObjectIdReader(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException
- Throws:
JsonMappingException
-
buildThrowableDeserializer
public JsonDeserializer<java.lang.Object> buildThrowableDeserializer(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException
- Throws:
JsonMappingException
-
constructBeanDeserializerBuilder
protected BeanDeserializerBuilder constructBeanDeserializerBuilder(DeserializationContext ctxt, BeanDescription beanDesc)
Overridable method that constructs aBeanDeserializerBuilder
which is used to accumulate information needed to create deserializer instance.
-
addBeanProps
protected void addBeanProps(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException
Method called to figure out settable properties for the bean deserializer to use.Note: designed to be overridable, and effort is made to keep interface similar between versions.
- Throws:
JsonMappingException
-
filterBeanProps
@Deprecated protected java.util.List<BeanPropertyDefinition> filterBeanProps(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder, java.util.List<BeanPropertyDefinition> propDefsIn, java.util.Set<java.lang.String> ignored) throws JsonMappingException
Deprecated.in 2.12, remove from 3.0Helper method called to filter out explicit ignored properties, as well as properties that have "ignorable types". Note that this will not remove properties that have no setters.- Throws:
JsonMappingException
-
filterBeanProps
protected java.util.List<BeanPropertyDefinition> filterBeanProps(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder, java.util.List<BeanPropertyDefinition> propDefsIn, java.util.Set<java.lang.String> ignored, java.util.Set<java.lang.String> included)
Helper method called to filter out explicit ignored properties, as well as properties that have "ignorable types". Note that this will not remove properties that have no setters.- Since:
- 2.12
-
addBackReferenceProperties
protected void addBackReferenceProperties(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException
Method that will find if bean has any managed- or back-reference properties, and if so add them to bean, to be linked during resolution phase.- Throws:
JsonMappingException
- Since:
- 2.9
-
addReferenceProperties
@Deprecated protected void addReferenceProperties(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException
Deprecated.- Throws:
JsonMappingException
-
addInjectables
protected void addInjectables(DeserializationContext ctxt, BeanDescription beanDesc, BeanDeserializerBuilder builder) throws JsonMappingException
Method called locate all members used for value injection (if any), constructorValueInjector
instances, and add them to builder.- Throws:
JsonMappingException
-
constructAnySetter
protected SettableAnyProperty constructAnySetter(DeserializationContext ctxt, BeanDescription beanDesc, AnnotatedMember mutator) throws JsonMappingException
Method called to construct fallbackSettableAnyProperty
for handling unknown bean properties, given a method that has been designated as such setter.- Parameters:
mutator
- Either 2-argument method (setter, with key and value), or Field that contains Map; either way accessor used for passing "any values"- Throws:
JsonMappingException
-
constructSettableProperty
protected SettableBeanProperty constructSettableProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef, JavaType propType0) throws JsonMappingException
Method that will construct a regular bean property setter using the given setter method.- Returns:
- Property constructed, if any; or null to indicate that there should be no property based on given definitions.
- Throws:
JsonMappingException
-
constructSetterlessProperty
protected SettableBeanProperty constructSetterlessProperty(DeserializationContext ctxt, BeanDescription beanDesc, BeanPropertyDefinition propDef) throws JsonMappingException
Method that will construct a regular bean property setter using the given setter method.- Throws:
JsonMappingException
-
isPotentialBeanType
protected boolean isPotentialBeanType(java.lang.Class<?> type)
Helper method used to skip processing for types that we know cannot be (i.e. are never consider to be) beans: things like primitives, Arrays, Enums, and proxy types.Note that usually we shouldn't really be getting these sort of types anyway; but better safe than sorry.
-
isIgnorableType
protected boolean isIgnorableType(DeserializationConfig config, BeanPropertyDefinition propDef, java.lang.Class<?> type, java.util.Map<java.lang.Class<?>,java.lang.Boolean> ignoredTypes)
Helper method that will check whether given raw type is marked as always ignorable (for purpose of ignoring properties with type)
-
_validateSubType
protected void _validateSubType(DeserializationContext ctxt, JavaType type, BeanDescription beanDesc) throws JsonMappingException
- Throws:
JsonMappingException
- Since:
- 2.8.11
-
-