Class MapperConfig<T extends MapperConfig<T>>
- java.lang.Object
 - 
- com.fasterxml.jackson.databind.cfg.MapperConfig<T>
 
 
- 
- All Implemented Interfaces:
 ClassIntrospector.MixInResolver,java.io.Serializable
- Direct Known Subclasses:
 MapperConfigBase
public abstract class MapperConfig<T extends MapperConfig<T>> extends java.lang.Object implements ClassIntrospector.MixInResolver, java.io.Serializable
Interface that defines functionality accessible through both serialization and deserialization configuration objects; accessors to mode-independent configuration settings and such. In addition, shared features are defined inMapperFeature.Small part of implementation is included here by aggregating
BaseSettingsinstance that contains configuration that is shared between different types of instances.- See Also:
 - Serialized Form
 
 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanOverrideAccessModifiers()Accessor for determining whether it is ok to try to force override of access modifiers to be able to get or set values of non-public Methods, Fields; to invoke non-public Constructors, Methods; or to instantiate non-public Classes.static <F extends java.lang.Enum<F> & ConfigFeature>
intcollectFeatureDefaults(java.lang.Class<F> enumClass)Method that calculates bit set (flags) of all features that are enabled by default.SerializableStringcompileString(java.lang.String src)Method for constructing a specialized textual object that can typically be serialized faster than basicString(depending on escaping needed if any, char-to-byte encoding if needed).JavaTypeconstructSpecializedType(JavaType baseType, java.lang.Class<?> subclass)JavaTypeconstructType(TypeReference<?> valueTypeRef)Helper method that will constructJavaTypefor given type reference This is a simple short-cut for:JavaTypeconstructType(java.lang.Class<?> cls)Helper method that will constructJavaTypefor given raw class.abstract ConfigOverridefindConfigOverride(java.lang.Class<?> type)Accessor for findingConfigOverrideto use for properties of given type, if any exist; or return `null` if not.abstract PropertyNamefindRootName(JavaType rootType)abstract PropertyNamefindRootName(java.lang.Class<?> rawRootType)AccessorNamingStrategy.ProvidergetAccessorNaming()abstract java.lang.Class<?>getActiveView()Accessor for finding currently active view, if any (null if none)AnnotationIntrospectorgetAnnotationIntrospector()Method for gettingAnnotationIntrospectorconfigured to introspect annotation values used for configuration.abstract ContextAttributesgetAttributes()Method for accessing per-instance shared (baseline/default) attribute values; these are used as the basis for per-call attributes.Base64VariantgetBase64Variant()Method called during deserialization if Base64 encoded content needs to be decoded.CacheProvidergetCacheProvider()ClassIntrospectorgetClassIntrospector()abstract ConfigOverridegetConfigOverride(java.lang.Class<?> type)Accessor for findingConfigOverrideto use for properties of given type, if any exist; or if none, return an immutable "empty" instance with no overrides.abstract DatatypeFeaturesgetDatatypeFeatures()java.text.DateFormatgetDateFormat()Method for accessing currently configured (textual) date format that will be used for reading or writing date values (in case of writing, only if textual output is configured; not if dates are to be serialized as time stamps).abstract JsonInclude.ValuegetDefaultInclusion(java.lang.Class<?> baseType, java.lang.Class<?> propertyType)Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type and possible per-type override for given property type.
NOTE: if no override found, defaults to value returned bygetDefaultPropertyInclusion().JsonInclude.ValuegetDefaultInclusion(java.lang.Class<?> baseType, java.lang.Class<?> propertyType, JsonInclude.Value defaultIncl)Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type and possible per-type override for given property type; but if none found, returning givendefaultInclabstract java.lang.BooleangetDefaultMergeable()Accessor for the baseline merge info used as the global baseline, not considering possible per-type overrides.abstract java.lang.BooleangetDefaultMergeable(java.lang.Class<?> baseType)Accessor for the baseline merge info used for given type, including global defaults if no type-specific overrides defined.abstract JsonFormat.ValuegetDefaultPropertyFormat(java.lang.Class<?> baseType)Accessor for default format settings to use for serialization (and, to a degree deserialization), considering baseline settings and per-type defaults for given base type (if any).abstract JsonIgnoreProperties.ValuegetDefaultPropertyIgnorals(java.lang.Class<?> baseType)Accessor for default property ignorals to use, if any, for given base type, based on config overrides settings (seefindConfigOverride(Class)).abstract JsonIgnoreProperties.ValuegetDefaultPropertyIgnorals(java.lang.Class<?> baseType, AnnotatedClass actualClass)Helper method that may be called to see if there are property ignoral definitions from annotations (viaAnnotatedClass) or through "config overrides".abstract JsonInclude.ValuegetDefaultPropertyInclusion()Accessor for default property inclusion to use for serialization, used unless overridden by per-type or per-property overrides.abstract JsonInclude.ValuegetDefaultPropertyInclusion(java.lang.Class<?> baseType)Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type.
NOTE: if no override found, defaults to value returned bygetDefaultPropertyInclusion().JsonInclude.ValuegetDefaultPropertyInclusion(java.lang.Class<?> baseType, JsonInclude.Value defaultIncl)Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type; but if none found, returning givendefaultInclabstract JsonIncludeProperties.ValuegetDefaultPropertyInclusions(java.lang.Class<?> baseType, AnnotatedClass actualClass)Helper method that may be called to see if there are property inclusion definitions from annotations (viaAnnotatedClass).abstract JsonSetter.ValuegetDefaultSetterInfo()Accessor for the baseline setter info used as the global baseline, not considering possible per-type overrides.TypeResolverBuilder<?>getDefaultTyper(JavaType baseType)Method called to locate a type info handler for types that do not have one explicitly declared via annotations (or other configuration).abstract VisibilityChecker<?>getDefaultVisibilityChecker()Accessor for object used for determining whether specific property elements (method, constructors, fields) can be auto-detected based on their visibility (access modifiers).abstract VisibilityChecker<?>getDefaultVisibilityChecker(java.lang.Class<?> baseType, AnnotatedClass actualClass)Accessor for object used for determining whether specific property elements (method, constructors, fields) can be auto-detected based on their visibility (access modifiers).HandlerInstantiatorgetHandlerInstantiator()java.util.LocalegetLocale()Method for accessing the defaultLocaleto use for formatting, unless overridden by local annotations.PolymorphicTypeValidatorgetPolymorphicTypeValidator()Simple accessor for defaultPolymorphicTypeValidatorto use for legacy Default Typing methods (ObjectMapper.enableDefaultTyping()) and annotation based enabling.PropertyNamingStrategygetPropertyNamingStrategy()abstract SubtypeResolvergetSubtypeResolver()java.util.TimeZonegetTimeZone()Method for accessing the defaultTimeZoneto use for formatting, unless overridden by local annotations.TypeFactorygetTypeFactory()booleanhasExplicitTimeZone()Method for checking whether aTimeZonehas been explicitly set for this configuring during construction ofObjectMapperor if it still has the default timezone/offset (zero-offset, "zulu").booleanhasMapperFeatures(int featureMask)Deprecated.Since 2.13 -- no replacementBeanDescriptionintrospectClassAnnotations(JavaType type)Accessor for getting bean description that only contains class annotations: useful if no getter/setter/creator information is needed.BeanDescriptionintrospectClassAnnotations(java.lang.Class<?> cls)Accessor for getting bean description that only contains class annotations: useful if no getter/setter/creator information is needed.BeanDescriptionintrospectDirectClassAnnotations(JavaType type)Accessor for getting bean description that only contains immediate class annotations: ones from the class, and its direct mix-in, if any, but not from super types.BeanDescriptionintrospectDirectClassAnnotations(java.lang.Class<?> cls)Accessor for getting bean description that only contains immediate class annotations: ones from the class, and its direct mix-in, if any, but not from super types.booleanisAnnotationProcessingEnabled()Method for determining whether annotation processing is enabled or not (default settings are typically that it is enabled; must explicitly disable).abstract booleanisEnabled(DatatypeFeature feature)Accessor for checking whether giveDatatypeFeatureis enabled or not.booleanisEnabled(MapperFeature f)Accessor for simple mapper features (which are shared for serialization, deserialization)booleanshouldSortPropertiesAlphabetically()Accessor for checking whether default settings for property handling indicate that properties should be alphabetically ordered or not.TypeIdResolvertypeIdResolverInstance(Annotated annotated, java.lang.Class<? extends TypeIdResolver> resolverClass)Method that can be called to obtain an instance ofTypeIdResolverof specified type.TypeResolverBuilder<?>typeResolverBuilderInstance(Annotated annotated, java.lang.Class<? extends TypeResolverBuilder<?>> builderClass)Method that can be called to obtain an instance ofTypeIdResolverof specified type.abstract booleanuseRootWrapping()Accessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.abstract Twith(MapperFeature... features)Method for constructing and returning a new instance with specified mapper features enabled.abstract Twith(MapperFeature feature, boolean state)abstract Twithout(MapperFeature... features)Method for constructing and returning a new instance with specified mapper features disabled.- 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface com.fasterxml.jackson.databind.introspect.ClassIntrospector.MixInResolver
copy, findMixInClassFor 
 - 
 
 - 
 
- 
- 
Method Detail
- 
collectFeatureDefaults
public static <F extends java.lang.Enum<F> & ConfigFeature> int collectFeatureDefaults(java.lang.Class<F> enumClass)
Method that calculates bit set (flags) of all features that are enabled by default. 
- 
with
public abstract T with(MapperFeature... features)
Method for constructing and returning a new instance with specified mapper features enabled. 
- 
without
public abstract T without(MapperFeature... features)
Method for constructing and returning a new instance with specified mapper features disabled. 
- 
with
public abstract T with(MapperFeature feature, boolean state)
- Since:
 - 2.3
 
 
- 
isEnabled
public final boolean isEnabled(MapperFeature f)
Accessor for simple mapper features (which are shared for serialization, deserialization) 
- 
hasMapperFeatures
@Deprecated public final boolean hasMapperFeatures(int featureMask)
Deprecated.Since 2.13 -- no replacement"Bulk" access method for checking that all features specified by mask are enabled.- Since:
 - 2.3
 
 
- 
isEnabled
public abstract boolean isEnabled(DatatypeFeature feature)
Accessor for checking whether giveDatatypeFeatureis enabled or not.- Parameters:
 feature- Feature to check- Returns:
 - True if feature is enabled; false otherwise
 - Since:
 - 2.15
 
 
- 
getDatatypeFeatures
public abstract DatatypeFeatures getDatatypeFeatures()
- Since:
 - 2.15
 
 
- 
isAnnotationProcessingEnabled
public final boolean isAnnotationProcessingEnabled()
Method for determining whether annotation processing is enabled or not (default settings are typically that it is enabled; must explicitly disable).- Returns:
 - True if annotation processing is enabled; false if not
 
 
- 
canOverrideAccessModifiers
public final boolean canOverrideAccessModifiers()
Accessor for determining whether it is ok to try to force override of access modifiers to be able to get or set values of non-public Methods, Fields; to invoke non-public Constructors, Methods; or to instantiate non-public Classes. By default this is enabled, but on some platforms it needs to be prevented since if this would violate security constraints and cause failures.- Returns:
 - True if access modifier overriding is allowed (and may be done for any Field, Method, Constructor or Class); false to prevent any attempts to override.
 
 
- 
shouldSortPropertiesAlphabetically
public final boolean shouldSortPropertiesAlphabetically()
Accessor for checking whether default settings for property handling indicate that properties should be alphabetically ordered or not. 
- 
useRootWrapping
public abstract boolean useRootWrapping()
Accessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not. 
- 
compileString
public SerializableString compileString(java.lang.String src)
Method for constructing a specialized textual object that can typically be serialized faster than basicString(depending on escaping needed if any, char-to-byte encoding if needed).- Parameters:
 src- Text to represent- Returns:
 - Optimized text object constructed
 - Since:
 - 2.4
 
 
- 
getClassIntrospector
public ClassIntrospector getClassIntrospector()
 
- 
getAnnotationIntrospector
public AnnotationIntrospector getAnnotationIntrospector()
Method for gettingAnnotationIntrospectorconfigured to introspect annotation values used for configuration.Non-final since it is actually overridden by sub-classes (for now?)
 
- 
getPropertyNamingStrategy
public final PropertyNamingStrategy getPropertyNamingStrategy()
 
- 
getAccessorNaming
public final AccessorNamingStrategy.Provider getAccessorNaming()
 
- 
getHandlerInstantiator
public final HandlerInstantiator getHandlerInstantiator()
 
- 
getDefaultTyper
public final TypeResolverBuilder<?> getDefaultTyper(JavaType baseType)
Method called to locate a type info handler for types that do not have one explicitly declared via annotations (or other configuration). If such default handler is configured, it is returned; otherwise null is returned. 
- 
getSubtypeResolver
public abstract SubtypeResolver getSubtypeResolver()
 
- 
getPolymorphicTypeValidator
public PolymorphicTypeValidator getPolymorphicTypeValidator()
Simple accessor for defaultPolymorphicTypeValidatorto use for legacy Default Typing methods (ObjectMapper.enableDefaultTyping()) and annotation based enabling.Since 2.11 will also check
MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPESto possibly override default to more restrictive implementation, seeDefaultBaseTypeLimitingValidator).- Since:
 - 2.10
 
 
- 
getTypeFactory
public final TypeFactory getTypeFactory()
 
- 
constructType
public final JavaType constructType(java.lang.Class<?> cls)
Helper method that will constructJavaTypefor given raw class. This is a simple short-cut for:getTypeFactory().constructType(cls); 
- 
constructType
public final JavaType constructType(TypeReference<?> valueTypeRef)
Helper method that will constructJavaTypefor given type reference This is a simple short-cut for:getTypeFactory().constructType(valueTypeRef); 
- 
constructSpecializedType
public JavaType constructSpecializedType(JavaType baseType, java.lang.Class<?> subclass)
 
- 
introspectClassAnnotations
public BeanDescription introspectClassAnnotations(java.lang.Class<?> cls)
Accessor for getting bean description that only contains class annotations: useful if no getter/setter/creator information is needed. 
- 
introspectClassAnnotations
public BeanDescription introspectClassAnnotations(JavaType type)
Accessor for getting bean description that only contains class annotations: useful if no getter/setter/creator information is needed. 
- 
introspectDirectClassAnnotations
public BeanDescription introspectDirectClassAnnotations(java.lang.Class<?> cls)
Accessor for getting bean description that only contains immediate class annotations: ones from the class, and its direct mix-in, if any, but not from super types. 
- 
introspectDirectClassAnnotations
public final BeanDescription introspectDirectClassAnnotations(JavaType type)
Accessor for getting bean description that only contains immediate class annotations: ones from the class, and its direct mix-in, if any, but not from super types. 
- 
findConfigOverride
public abstract ConfigOverride findConfigOverride(java.lang.Class<?> type)
Accessor for findingConfigOverrideto use for properties of given type, if any exist; or return `null` if not.Note that only directly associated override is found; no type hierarchy traversal is performed.
- Returns:
 - Override object to use for the type, if defined; null if none.
 - Since:
 - 2.8
 
 
- 
getConfigOverride
public abstract ConfigOverride getConfigOverride(java.lang.Class<?> type)
Accessor for findingConfigOverrideto use for properties of given type, if any exist; or if none, return an immutable "empty" instance with no overrides.Note that only directly associated override is found; no type hierarchy traversal is performed.
- Returns:
 - Override object to use for the type, never null (but may be empty)
 - Since:
 - 2.9
 
 
- 
getDefaultPropertyInclusion
public abstract JsonInclude.Value getDefaultPropertyInclusion()
Accessor for default property inclusion to use for serialization, used unless overridden by per-type or per-property overrides.- Since:
 - 2.7
 
 
- 
getDefaultPropertyInclusion
public abstract JsonInclude.Value getDefaultPropertyInclusion(java.lang.Class<?> baseType)
Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type.
NOTE: if no override found, defaults to value returned bygetDefaultPropertyInclusion().- Since:
 - 2.7
 
 
- 
getDefaultPropertyInclusion
public JsonInclude.Value getDefaultPropertyInclusion(java.lang.Class<?> baseType, JsonInclude.Value defaultIncl)
Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type; but if none found, returning givendefaultIncl- Parameters:
 defaultIncl- Inclusion setting to return if no overrides found.- Since:
 - 2.8.2
 
 
- 
getDefaultInclusion
public abstract JsonInclude.Value getDefaultInclusion(java.lang.Class<?> baseType, java.lang.Class<?> propertyType)
Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type and possible per-type override for given property type.
NOTE: if no override found, defaults to value returned bygetDefaultPropertyInclusion().- Parameters:
 baseType- Type of the instance containing the targeted property.propertyType- Type of the property to look up inclusion setting for.- Since:
 - 2.9
 
 
- 
getDefaultInclusion
public JsonInclude.Value getDefaultInclusion(java.lang.Class<?> baseType, java.lang.Class<?> propertyType, JsonInclude.Value defaultIncl)
Accessor for default property inclusion to use for serialization, considering possible per-type override for given base type and possible per-type override for given property type; but if none found, returning givendefaultIncl- Parameters:
 baseType- Type of the instance containing the targeted property.propertyType- Type of the property to look up inclusion setting for.defaultIncl- Inclusion setting to return if no overrides found.- Since:
 - 2.9
 
 
- 
getDefaultPropertyFormat
public abstract JsonFormat.Value getDefaultPropertyFormat(java.lang.Class<?> baseType)
Accessor for default format settings to use for serialization (and, to a degree deserialization), considering baseline settings and per-type defaults for given base type (if any).- Since:
 - 2.7
 
 
- 
getDefaultPropertyIgnorals
public abstract JsonIgnoreProperties.Value getDefaultPropertyIgnorals(java.lang.Class<?> baseType)
Accessor for default property ignorals to use, if any, for given base type, based on config overrides settings (seefindConfigOverride(Class)).- Since:
 - 2.8
 
 
- 
getDefaultPropertyIgnorals
public abstract JsonIgnoreProperties.Value getDefaultPropertyIgnorals(java.lang.Class<?> baseType, AnnotatedClass actualClass)
Helper method that may be called to see if there are property ignoral definitions from annotations (viaAnnotatedClass) or through "config overrides". If both exist, config overrides have precedence over class annotations.- Since:
 - 2.8
 
 
- 
getDefaultPropertyInclusions
public abstract JsonIncludeProperties.Value getDefaultPropertyInclusions(java.lang.Class<?> baseType, AnnotatedClass actualClass)
Helper method that may be called to see if there are property inclusion definitions from annotations (viaAnnotatedClass). TODO: config override.- Since:
 - 2.12
 
 
- 
getDefaultVisibilityChecker
public abstract VisibilityChecker<?> getDefaultVisibilityChecker()
Accessor for object used for determining whether specific property elements (method, constructors, fields) can be auto-detected based on their visibility (access modifiers). Can be changed to allow different minimum visibility levels for auto-detection. Note that this is the global handler; individual types (classes) can further override active checker used (usingJsonAutoDetectannotation) 
- 
getDefaultVisibilityChecker
public abstract VisibilityChecker<?> getDefaultVisibilityChecker(java.lang.Class<?> baseType, AnnotatedClass actualClass)
Accessor for object used for determining whether specific property elements (method, constructors, fields) can be auto-detected based on their visibility (access modifiers). This is based on global defaults (as would be returned bygetDefaultVisibilityChecker(), but then modified by possible class annotation (seeJsonAutoDetect) and/or per-type config override (seeConfigOverride.getVisibility()).- Since:
 - 2.9
 
 
- 
getDefaultSetterInfo
public abstract JsonSetter.Value getDefaultSetterInfo()
Accessor for the baseline setter info used as the global baseline, not considering possible per-type overrides.- Returns:
 - Global base settings; never null
 - Since:
 - 2.9
 
 
- 
getDefaultMergeable
public abstract java.lang.Boolean getDefaultMergeable()
Accessor for the baseline merge info used as the global baseline, not considering possible per-type overrides.- Returns:
 - Global base settings, if any; `null` if none.
 - Since:
 - 2.9
 
 
- 
getDefaultMergeable
public abstract java.lang.Boolean getDefaultMergeable(java.lang.Class<?> baseType)
Accessor for the baseline merge info used for given type, including global defaults if no type-specific overrides defined.- Returns:
 - Type-specific settings (if any); global defaults (same as
    
getDefaultMergeable()) otherwise, if any defined; or `null` if neither defined - Since:
 - 2.9
 
 
- 
getDateFormat
public final java.text.DateFormat getDateFormat()
Method for accessing currently configured (textual) date format that will be used for reading or writing date values (in case of writing, only if textual output is configured; not if dates are to be serialized as time stamps).Note that typically
DateFormatinstances are not thread-safe (at least ones provided by JDK): this means that calling code should clone format instance before using it.This method is usually only called by framework itself, since there are convenience methods available via
DeserializationContextandSerializerProviderthat take care of cloning and thread-safe reuse. 
- 
getLocale
public final java.util.Locale getLocale()
Method for accessing the defaultLocaleto use for formatting, unless overridden by local annotations. Initially set toLocale.getDefault(). 
- 
getTimeZone
public final java.util.TimeZone getTimeZone()
Method for accessing the defaultTimeZoneto use for formatting, unless overridden by local annotations. Initially set toTimeZone.getDefault(). 
- 
hasExplicitTimeZone
public boolean hasExplicitTimeZone()
Method for checking whether aTimeZonehas been explicitly set for this configuring during construction ofObjectMapperor if it still has the default timezone/offset (zero-offset, "zulu").- Returns:
 trueif this configuration has explicitly specifiedTimeZone, orfalseif it uses the default time zone- Since:
 - 2.12
 
 
- 
getActiveView
public abstract java.lang.Class<?> getActiveView()
Accessor for finding currently active view, if any (null if none) 
- 
getBase64Variant
public Base64Variant getBase64Variant()
Method called during deserialization if Base64 encoded content needs to be decoded. Default version just returns default Jackson uses, which is modified-mime which does not add linefeeds (because those would have to be escaped in JSON strings); but this can be configured onObjectWriter. 
- 
getAttributes
public abstract ContextAttributes getAttributes()
Method for accessing per-instance shared (baseline/default) attribute values; these are used as the basis for per-call attributes.- Since:
 - 2.3
 
 
- 
findRootName
public abstract PropertyName findRootName(JavaType rootType)
- Since:
 - 2.6
 
 
- 
findRootName
public abstract PropertyName findRootName(java.lang.Class<?> rawRootType)
- Since:
 - 2.6
 
 
- 
getCacheProvider
public CacheProvider getCacheProvider()
- Since:
 - 2.16
 
 
- 
typeResolverBuilderInstance
public TypeResolverBuilder<?> typeResolverBuilderInstance(Annotated annotated, java.lang.Class<? extends TypeResolverBuilder<?>> builderClass)
Method that can be called to obtain an instance ofTypeIdResolverof specified type. 
- 
typeIdResolverInstance
public TypeIdResolver typeIdResolverInstance(Annotated annotated, java.lang.Class<? extends TypeIdResolver> resolverClass)
Method that can be called to obtain an instance ofTypeIdResolverof specified type. 
 - 
 
 -