Package com.fasterxml.jackson.databind
Class DeserializationConfig
- java.lang.Object
-
- com.fasterxml.jackson.databind.cfg.MapperConfig<T>
-
- com.fasterxml.jackson.databind.cfg.MapperConfigBase<DeserializationFeature,DeserializationConfig>
-
- com.fasterxml.jackson.databind.DeserializationConfig
-
- All Implemented Interfaces:
ClassIntrospector.MixInResolver,Serializable
public final class DeserializationConfig extends MapperConfigBase<DeserializationFeature,DeserializationConfig> implements Serializable
Object that contains baseline configuration for deserialization process. An instance is owned byObjectMapper, which passes an immutable instance to be used for deserialization process.Note that instances are considered immutable and as such no copies should need to be created for sharing; all copying is done with "fluent factory" methods.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int_deserFeaturesSet ofDeserializationFeatures enabled.protected int_formatReadFeaturesStates ofFormatFeatures to enable/disable.protected int_formatReadFeaturesToChangeBitflag ofFormatFeatures to enable/disableprotected JsonNodeFactory_nodeFactoryFactory used for constructingJsonNodeinstances.protected int_parserFeaturesStates ofJsonParser.Features to enable/disable.protected int_parserFeaturesToChangeBitflag ofJsonParser.Features to enable/disableprotected LinkedNode<DeserializationProblemHandler>_problemHandlersLinked list that contains all registered problem handlers.-
Fields inherited from class com.fasterxml.jackson.databind.cfg.MapperConfigBase
_attributes, _configOverrides, _mixIns, _rootName, _rootNames, _subtypeResolver, _view, EMPTY_OVERRIDE
-
Fields inherited from class com.fasterxml.jackson.databind.cfg.MapperConfig
_base, _mapperFeatures, EMPTY_FORMAT, EMPTY_INCLUDE
-
-
Constructor Summary
Constructors Modifier Constructor Description DeserializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)Constructor used by ObjectMapper to create default configuration object instance.protectedDeserializationConfig(DeserializationConfig src, ContextAttributes attrs)protectedDeserializationConfig(DeserializationConfig src, SimpleMixInResolver mixins)protectedDeserializationConfig(DeserializationConfig src, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)Copy-constructor used for making a copy used by newObjectMapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DeserializationConfig_withBase(BaseSettings newBase)protected DeserializationConfig_withMapperFeatures(int mapperFeatures)TypeDeserializerfindTypeDeserializer(JavaType baseType)Helper method that is needed to properly handle polymorphic referenced types, such as types referenced byAtomicReference, or various "optional" types.protected BaseSettingsgetBaseSettings()intgetDeserializationFeatures()Bulk access method for getting the bit mask of allDeserializationFeatures that are enabled.JsonNodeFactorygetNodeFactory()LinkedNode<DeserializationProblemHandler>getProblemHandlers()Method for getting head of the problem handler chain.booleanhasDeserializationFeatures(int featureMask)Bulk access method for checking that all features specified by mask are enabled.booleanhasSomeOfFeatures(int featureMask)Bulk access method for checking that at least one of features specified by mask is enabled.voidinitialize(com.fasterxml.jackson.core.JsonParser p)Method called byObjectMapperandObjectReaderto modify thoseJsonParser.Featuresettings that have been configured via this config instance.<T extends BeanDescription>
Tintrospect(JavaType type)Method that will introspect full bean properties for the purpose of building a bean deserializer<T extends BeanDescription>
TintrospectForBuilder(JavaType type)<T extends BeanDescription>
TintrospectForCreation(JavaType type)Method that will introspect subset of bean properties needed to construct bean instance.booleanisEnabled(com.fasterxml.jackson.core.JsonParser.Feature f, com.fasterxml.jackson.core.JsonFactory factory)booleanisEnabled(DeserializationFeature f)booleanrequiresFullValue()Convenience method equivalant to:isEnabled(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)booleanuseRootWrapping()Accessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.DeserializationConfigwith(com.fasterxml.jackson.core.FormatFeature feature)Fluent factory method that will construct and return a new configuration object instance with specified features enabled.DeserializationConfigwith(com.fasterxml.jackson.core.JsonParser.Feature feature)Fluent factory method that will construct and return a new configuration object instance with specified features enabled.DeserializationConfigwith(ContextAttributes attrs)Method for constructing an instance that has specified contextual attributes.DeserializationConfigwith(DeserializationFeature feature)Fluent factory method that will construct and return a new configuration object instance with specified features enabled.DeserializationConfigwith(DeserializationFeature first, DeserializationFeature... features)Fluent factory method that will construct and return a new configuration object instance with specified features enabled.DeserializationConfigwith(SubtypeResolver str)Method for constructing and returning a new instance with differentSubtypeResolverto use.DeserializationConfigwith(JsonNodeFactory f)Fluent factory method that will construct a new instance with specifiedJsonNodeFactoryDeserializationConfigwithFeatures(com.fasterxml.jackson.core.FormatFeature... features)Fluent factory method that will construct and return a new configuration object instance with specified features enabled.DeserializationConfigwithFeatures(com.fasterxml.jackson.core.JsonParser.Feature... features)Fluent factory method that will construct and return a new configuration object instance with specified features enabled.DeserializationConfigwithFeatures(DeserializationFeature... features)Fluent factory method that will construct and return a new configuration object instance with specified features enabled.DeserializationConfigwithHandler(DeserializationProblemHandler h)Method that can be used to add a handler that can (try to) resolve non-fatal deserialization problems.DeserializationConfigwithNoProblemHandlers()Method for removing all configured problem handlers; usually done to replace existing handler(s) with different one(s)DeserializationConfigwithout(com.fasterxml.jackson.core.FormatFeature feature)Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.DeserializationConfigwithout(com.fasterxml.jackson.core.JsonParser.Feature feature)Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.DeserializationConfigwithout(DeserializationFeature feature)Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.DeserializationConfigwithout(DeserializationFeature first, DeserializationFeature... features)Fluent factory method that will construct and return a new configuration object instance with specified features disabled.DeserializationConfigwithoutFeatures(com.fasterxml.jackson.core.FormatFeature... features)Fluent factory method that will construct and return a new configuration object instance with specified features disabled.DeserializationConfigwithoutFeatures(com.fasterxml.jackson.core.JsonParser.Feature... features)Fluent factory method that will construct and return a new configuration object instance with specified features disabled.DeserializationConfigwithoutFeatures(DeserializationFeature... features)Fluent factory method that will construct and return a new configuration object instance with specified features disabled.DeserializationConfigwithRootName(PropertyName rootName)Method for constructing and returning a new instance with different root name to use (none, if null).DeserializationConfigwithView(Class<?> view)Method for constructing and returning a new instance with different view to use.-
Methods inherited from class com.fasterxml.jackson.databind.cfg.MapperConfigBase
copy, findConfigOverride, findMixInClassFor, findRootName, findRootName, getActiveView, getAttributes, getConfigOverride, getDefaultInclusion, getDefaultMergeable, getDefaultMergeable, getDefaultPropertyFormat, getDefaultPropertyIgnorals, getDefaultPropertyIgnorals, getDefaultPropertyInclusion, getDefaultPropertyInclusion, getDefaultSetterInfo, getDefaultVisibilityChecker, getDefaultVisibilityChecker, getFullRootName, getRootName, getSubtypeResolver, mixInCount, with, with, with, with, with, with, with, with, with, with, with, with, withAppendedAnnotationIntrospector, withAttribute, withAttributes, withInsertedAnnotationIntrospector, without, withoutAttribute, withRootName
-
Methods inherited from class com.fasterxml.jackson.databind.cfg.MapperConfig
canOverrideAccessModifiers, collectFeatureDefaults, compileString, constructSpecializedType, constructType, constructType, getAnnotationIntrospector, getBase64Variant, getClassIntrospector, getDateFormat, getDefaultInclusion, getDefaultPropertyInclusion, getDefaultTyper, getHandlerInstantiator, getLocale, getPolymorphicTypeValidator, getPropertyNamingStrategy, getTimeZone, getTypeFactory, hasMapperFeatures, introspectClassAnnotations, introspectClassAnnotations, introspectDirectClassAnnotations, introspectDirectClassAnnotations, isAnnotationProcessingEnabled, isEnabled, shouldSortPropertiesAlphabetically, typeIdResolverInstance, typeResolverBuilderInstance
-
-
-
-
Field Detail
-
_problemHandlers
protected final LinkedNode<DeserializationProblemHandler> _problemHandlers
Linked list that contains all registered problem handlers. Implementation as front-added linked list allows for sharing of the list (tail) without copying the list.
-
_nodeFactory
protected final JsonNodeFactory _nodeFactory
Factory used for constructingJsonNodeinstances.
-
_deserFeatures
protected final int _deserFeatures
Set ofDeserializationFeatures enabled.
-
_parserFeatures
protected final int _parserFeatures
States ofJsonParser.Features to enable/disable.
-
_parserFeaturesToChange
protected final int _parserFeaturesToChange
Bitflag ofJsonParser.Features to enable/disable
-
_formatReadFeatures
protected final int _formatReadFeatures
States ofFormatFeatures to enable/disable.- Since:
- 2.7
-
_formatReadFeaturesToChange
protected final int _formatReadFeaturesToChange
Bitflag ofFormatFeatures to enable/disable- Since:
- 2.7
-
-
Constructor Detail
-
DeserializationConfig
public DeserializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)
Constructor used by ObjectMapper to create default configuration object instance.
-
DeserializationConfig
protected DeserializationConfig(DeserializationConfig src, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)
Copy-constructor used for making a copy used by newObjectMapper.- Since:
- 2.9
-
DeserializationConfig
protected DeserializationConfig(DeserializationConfig src, ContextAttributes attrs)
-
DeserializationConfig
protected DeserializationConfig(DeserializationConfig src, SimpleMixInResolver mixins)
-
-
Method Detail
-
getBaseSettings
protected BaseSettings getBaseSettings()
-
_withBase
protected final DeserializationConfig _withBase(BaseSettings newBase)
- Specified by:
_withBasein classMapperConfigBase<DeserializationFeature,DeserializationConfig>
-
_withMapperFeatures
protected final DeserializationConfig _withMapperFeatures(int mapperFeatures)
- Specified by:
_withMapperFeaturesin classMapperConfigBase<DeserializationFeature,DeserializationConfig>
-
with
public DeserializationConfig with(SubtypeResolver str)
Description copied from class:MapperConfigBaseMethod for constructing and returning a new instance with differentSubtypeResolverto use.NOTE: make sure to register new instance with
ObjectMapperif directly calling this method.- Specified by:
within classMapperConfigBase<DeserializationFeature,DeserializationConfig>
-
withRootName
public DeserializationConfig withRootName(PropertyName rootName)
Description copied from class:MapperConfigBaseMethod for constructing and returning a new instance with different root name to use (none, if null).Note that when a root name is set to a non-Empty String, this will automatically force use of root element wrapping with given name. If empty String passed, will disable root name wrapping; and if null used, will instead use
SerializationFeatureto determine if to use wrapping, and annotation (or default name) for actual root name to use.- Specified by:
withRootNamein classMapperConfigBase<DeserializationFeature,DeserializationConfig>- Parameters:
rootName- to use: if null, means "use default" (clear setting); if empty String ("") means that no root name wrapping is used; otherwise defines root name to use.
-
withView
public DeserializationConfig withView(Class<?> view)
Description copied from class:MapperConfigBaseMethod for constructing and returning a new instance with different view to use.- Specified by:
withViewin classMapperConfigBase<DeserializationFeature,DeserializationConfig>
-
with
public DeserializationConfig with(ContextAttributes attrs)
Description copied from class:MapperConfigBaseMethod for constructing an instance that has specified contextual attributes.- Specified by:
within classMapperConfigBase<DeserializationFeature,DeserializationConfig>
-
with
public DeserializationConfig with(DeserializationFeature feature)
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.
-
with
public DeserializationConfig with(DeserializationFeature first, DeserializationFeature... features)
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.
-
withFeatures
public DeserializationConfig withFeatures(DeserializationFeature... features)
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.
-
without
public DeserializationConfig without(DeserializationFeature feature)
Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.
-
without
public DeserializationConfig without(DeserializationFeature first, DeserializationFeature... features)
Fluent factory method that will construct and return a new configuration object instance with specified features disabled.
-
withoutFeatures
public DeserializationConfig withoutFeatures(DeserializationFeature... features)
Fluent factory method that will construct and return a new configuration object instance with specified features disabled.
-
with
public DeserializationConfig with(com.fasterxml.jackson.core.JsonParser.Feature feature)
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.- Since:
- 2.5
-
withFeatures
public DeserializationConfig withFeatures(com.fasterxml.jackson.core.JsonParser.Feature... features)
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.- Since:
- 2.5
-
without
public DeserializationConfig without(com.fasterxml.jackson.core.JsonParser.Feature feature)
Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.- Since:
- 2.5
-
withoutFeatures
public DeserializationConfig withoutFeatures(com.fasterxml.jackson.core.JsonParser.Feature... features)
Fluent factory method that will construct and return a new configuration object instance with specified features disabled.- Since:
- 2.5
-
with
public DeserializationConfig with(com.fasterxml.jackson.core.FormatFeature feature)
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.- Since:
- 2.7
-
withFeatures
public DeserializationConfig withFeatures(com.fasterxml.jackson.core.FormatFeature... features)
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.- Since:
- 2.7
-
without
public DeserializationConfig without(com.fasterxml.jackson.core.FormatFeature feature)
Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.- Since:
- 2.7
-
withoutFeatures
public DeserializationConfig withoutFeatures(com.fasterxml.jackson.core.FormatFeature... features)
Fluent factory method that will construct and return a new configuration object instance with specified features disabled.- Since:
- 2.7
-
with
public DeserializationConfig with(JsonNodeFactory f)
Fluent factory method that will construct a new instance with specifiedJsonNodeFactory
-
withHandler
public DeserializationConfig withHandler(DeserializationProblemHandler h)
Method that can be used to add a handler that can (try to) resolve non-fatal deserialization problems.
-
withNoProblemHandlers
public DeserializationConfig withNoProblemHandlers()
Method for removing all configured problem handlers; usually done to replace existing handler(s) with different one(s)
-
initialize
public void initialize(com.fasterxml.jackson.core.JsonParser p)
Method called byObjectMapperandObjectReaderto modify thoseJsonParser.Featuresettings that have been configured via this config instance.- Since:
- 2.5
-
useRootWrapping
public boolean useRootWrapping()
Description copied from class:MapperConfigAccessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.- Specified by:
useRootWrappingin classMapperConfig<DeserializationConfig>
-
isEnabled
public final boolean isEnabled(DeserializationFeature f)
-
isEnabled
public final boolean isEnabled(com.fasterxml.jackson.core.JsonParser.Feature f, com.fasterxml.jackson.core.JsonFactory factory)
-
hasDeserializationFeatures
public final boolean hasDeserializationFeatures(int featureMask)
Bulk access method for checking that all features specified by mask are enabled.- Since:
- 2.3
-
hasSomeOfFeatures
public final boolean hasSomeOfFeatures(int featureMask)
Bulk access method for checking that at least one of features specified by mask is enabled.- Since:
- 2.6
-
getDeserializationFeatures
public final int getDeserializationFeatures()
Bulk access method for getting the bit mask of allDeserializationFeatures that are enabled.
-
requiresFullValue
public final boolean requiresFullValue()
Convenience method equivalant to:isEnabled(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)- Since:
- 2.9
-
getProblemHandlers
public LinkedNode<DeserializationProblemHandler> getProblemHandlers()
Method for getting head of the problem handler chain. May be null, if no handlers have been added.
-
getNodeFactory
public final JsonNodeFactory getNodeFactory()
-
introspect
public <T extends BeanDescription> T introspect(JavaType type)
Method that will introspect full bean properties for the purpose of building a bean deserializer- Parameters:
type- Type of class to be introspected
-
introspectForCreation
public <T extends BeanDescription> T introspectForCreation(JavaType type)
Method that will introspect subset of bean properties needed to construct bean instance.
-
introspectForBuilder
public <T extends BeanDescription> T introspectForBuilder(JavaType type)
- Since:
- 2.0
-
findTypeDeserializer
public TypeDeserializer findTypeDeserializer(JavaType baseType) throws JsonMappingException
Helper method that is needed to properly handle polymorphic referenced types, such as types referenced byAtomicReference, or various "optional" types.- Throws:
JsonMappingException- Since:
- 2.4
-
-