Package com.fasterxml.jackson.databind
Class DeserializationConfig
java.lang.Object
com.fasterxml.jackson.databind.cfg.MapperConfig<DeserializationConfig>
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 by
ObjectMapper, 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:
-
Constructor Summary
ConstructorsConstructorDescriptionDeserializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides, CoercionConfigs coercionConfigs, DatatypeFeatures datatypeFeatures) Constructor used by ObjectMapper to create default configuration object instance. -
Method Summary
Modifier and TypeMethodDescriptionfindCoercionAction(LogicalType targetType, Class<?> targetClass, CoercionInputShape inputShape) General-purpose accessor for finding what to do when specified coercion from shape that is now always allowed to be coerced from is requested.findCoercionFromBlankString(LogicalType targetType, Class<?> targetClass, CoercionAction actionIfBlankNotAllowed) More specialized accessor called in case of input being a blank String (one consisting of only white space characters with length of at least one).findTypeDeserializer(JavaType baseType) Helper method that is needed to properly handle polymorphic referenced types, such as types referenced byAtomicReference, or various "optional" types.final intBulk access method for getting the bit mask of allDeserializationFeatures that are enabled.final JsonNodeFactoryMethod for getting head of the problem handler chain.final booleanhasDeserializationFeatures(int featureMask) Bulk access method for checking that all features specified by mask are enabled.final booleanhasSomeOfFeatures(int featureMask) Bulk access method for checking that at least one of features specified by mask is enabled.Method called byObjectMapperandObjectReaderto modify thoseJsonParser.Featuresettings that have been configured via this config instance.initialize(JsonParser p, FormatSchema schema) introspect(JavaType type) Method that will introspect full bean properties for the purpose of building a bean deserializerintrospectForBuilder(JavaType type) Deprecated.Since 2.12 - use variant that takes both builder and value typeintrospectForBuilder(JavaType builderType, BeanDescription valueTypeDesc) Method that will introspect subset of bean properties needed to construct bean instance.final booleanisEnabled(JsonParser.Feature f, JsonFactory factory) final booleanisEnabled(DatatypeFeature feature) Accessor for checking whether giveDatatypeFeatureis enabled or not.final booleanisEnabled(DeserializationFeature feature) Accessor for checking whether giveDeserializationFeatureis enabled or not.final booleanConvenience method equivalent to:isEnabled(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)booleanAccessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.with(FormatFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.with(JsonParser.Feature feature) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.with(ConstructorDetector ctorDetector) with(ContextAttributes attrs) Method for constructing an instance that has specified contextual attributes.with(DeserializationFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.with(DeserializationFeature first, DeserializationFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.with(SubtypeResolver str) Method for constructing and returning a new instance with differentSubtypeResolverto use.Fluent factory method that will construct a new instance with specifiedJsonNodeFactorywithFeatures(FormatFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.withFeatures(JsonParser.Feature... features) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.withFeatures(DeserializationFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.Method that can be used to add a handler that can (try to) resolve non-fatal deserialization problems.Method for removing all configured problem handlers; usually done to replace existing handler(s) with different one(s)without(FormatFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.without(JsonParser.Feature feature) Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.without(DeserializationFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.without(DeserializationFeature first, DeserializationFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features disabled.withoutFeatures(FormatFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features disabled.withoutFeatures(JsonParser.Feature... features) Fluent factory method that will construct and return a new configuration object instance with specified features disabled.withoutFeatures(DeserializationFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features disabled.withRootName(PropertyName rootName) Method for constructing and returning a new instance with different root name to use (none, if null).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, getDatatypeFeatures, getDefaultInclusion, getDefaultMergeable, getDefaultMergeable, getDefaultPropertyFormat, getDefaultPropertyIgnorals, getDefaultPropertyIgnorals, getDefaultPropertyInclusion, getDefaultPropertyInclusion, getDefaultPropertyInclusions, getDefaultSetterInfo, getDefaultVisibilityChecker, getDefaultVisibilityChecker, getFullRootName, getRootName, getSubtypeResolver, mixInCount, with, with, with, with, with, with, with, with, with, with, with, with, with, with, with, with, withAppendedAnnotationIntrospector, withAttribute, withAttributes, withFeatures, withInsertedAnnotationIntrospector, without, without, withoutAttribute, withoutFeatures, withRootNameMethods inherited from class com.fasterxml.jackson.databind.cfg.MapperConfig
canOverrideAccessModifiers, collectFeatureDefaults, compileString, constructSpecializedType, constructType, constructType, getAccessorNaming, getAnnotationIntrospector, getBase64Variant, getCacheProvider, getClassIntrospector, getDateFormat, getDefaultInclusion, getDefaultPropertyInclusion, getDefaultTyper, getHandlerInstantiator, getLocale, getPolymorphicTypeValidator, getPropertyNamingStrategy, getTimeZone, getTypeFactory, hasExplicitTimeZone, hasMapperFeatures, introspectClassAnnotations, introspectClassAnnotations, introspectDirectClassAnnotations, introspectDirectClassAnnotations, isAnnotationProcessingEnabled, isEnabled, shouldSortPropertiesAlphabetically, typeIdResolverInstance, typeResolverBuilderInstance
-
Constructor Details
-
DeserializationConfig
public DeserializationConfig(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides, CoercionConfigs coercionConfigs, DatatypeFeatures datatypeFeatures) Constructor used by ObjectMapper to create default configuration object instance.- Since:
- 2.14
-
-
Method Details
-
with
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
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
Description copied from class:MapperConfigBaseMethod for constructing and returning a new instance with different view to use.- Specified by:
withViewin classMapperConfigBase<DeserializationFeature,DeserializationConfig>
-
with
Description copied from class:MapperConfigBaseMethod for constructing an instance that has specified contextual attributes.- Specified by:
within classMapperConfigBase<DeserializationFeature,DeserializationConfig>
-
with
Fluent factory method that will construct and return a new configuration object instance with specified features enabled. -
with
Fluent factory method that will construct and return a new configuration object instance with specified features enabled. -
withFeatures
Fluent factory method that will construct and return a new configuration object instance with specified features enabled. -
without
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
Fluent factory method that will construct and return a new configuration object instance with specified features disabled. -
with
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.- Since:
- 2.5
-
withFeatures
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.- Since:
- 2.5
-
without
Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.- Since:
- 2.5
-
withoutFeatures
Fluent factory method that will construct and return a new configuration object instance with specified features disabled.- Since:
- 2.5
-
with
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.- Since:
- 2.7
-
withFeatures
Fluent factory method that will construct and return a new configuration object instance with specified features enabled.- Since:
- 2.7
-
without
Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.- Since:
- 2.7
-
withoutFeatures
Fluent factory method that will construct and return a new configuration object instance with specified features disabled.- Since:
- 2.7
-
with
Fluent factory method that will construct a new instance with specifiedJsonNodeFactory -
with
- Since:
- 2.12
-
withHandler
Method that can be used to add a handler that can (try to) resolve non-fatal deserialization problems. -
withNoProblemHandlers
Method for removing all configured problem handlers; usually done to replace existing handler(s) with different one(s) -
initialize
Method called byObjectMapperandObjectReaderto modify thoseJsonParser.Featuresettings that have been configured via this config instance.- Since:
- 2.5
-
initialize
- Since:
- 2.12
-
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
Accessor for checking whether giveDeserializationFeatureis enabled or not.- Parameters:
feature- Feature to check- Returns:
- True if feature is enabled; false otherwise
-
isEnabled
-
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 equivalent to:isEnabled(DeserializationFeature.FAIL_ON_TRAILING_TOKENS)- Since:
- 2.9
-
isEnabled
Accessor for checking whether giveDatatypeFeatureis enabled or not.- Specified by:
isEnabledin classMapperConfig<DeserializationConfig>- Parameters:
feature- Feature to check- Returns:
- True if feature is enabled; false otherwise
- Since:
- 2.14
-
getProblemHandlers
Method for getting head of the problem handler chain. May be null, if no handlers have been added. -
getNodeFactory
-
getConstructorDetector
- Since:
- 2.12
-
introspect
Method that will introspect full bean properties for the purpose of building a bean deserializer- Parameters:
type- Type of class to be introspected
-
introspectForCreation
Method that will introspect subset of bean properties needed to construct bean instance. -
introspectForBuilder
- Since:
- 2.12
-
introspectForBuilder
Deprecated.Since 2.12 - use variant that takes both builder and value type- Since:
- 2.0
-
findTypeDeserializer
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
-
findCoercionAction
public CoercionAction findCoercionAction(LogicalType targetType, Class<?> targetClass, CoercionInputShape inputShape) General-purpose accessor for finding what to do when specified coercion from shape that is now always allowed to be coerced from is requested.- Parameters:
targetType- Logical target type of coerciontargetClass- Physical target type of coercioninputShape- Input shape to coerce from- Returns:
- CoercionAction configured for specific coercion
- Since:
- 2.12
-
findCoercionFromBlankString
public CoercionAction findCoercionFromBlankString(LogicalType targetType, Class<?> targetClass, CoercionAction actionIfBlankNotAllowed) More specialized accessor called in case of input being a blank String (one consisting of only white space characters with length of at least one). Will basically first determine if "blank as empty" is allowed: if not, returnsactionIfBlankNotAllowed, otherwise returns action forCoercionInputShape.EmptyString.- Parameters:
targetType- Logical target type of coerciontargetClass- Physical target type of coercionactionIfBlankNotAllowed- Return value to use in case "blanks as empty" is not allowed- Returns:
- CoercionAction configured for specified coercion from blank string
- Since:
- 2.12
-