Class MapperConfigBase<CFG extends ConfigFeature,T extends MapperConfigBase<CFG,T>>
- All Implemented Interfaces:
Serializable,Snapshottable<MixInResolver>,MixInResolver
- Direct Known Subclasses:
DeserializationConfig,SerializationConfig
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ContextAttributesContextual attributes accessible (get and set) during processing, on per-call basis.protected final ClassIntrospectorprotected final ConfigOverridesConfiguration overrides to apply, keyed by type of property.protected final DatatypeFeaturesSet ofDatatypeFeatures enabled.protected final MixInHandlerMix-in annotation mappings to use, if any.protected final PropertyNameExplicitly defined root name to use, if any; if empty String, will disable root-name wrapping; if null, will use defaultsprotected final RootNameLookupSimple cache used for finding out possible root name for root name wrapping.protected final SubtypeResolverRegistered concrete subtypes that can be used instead of (or in addition to) ones declared using annotations.protected final TypeFactorySpecific factory used for creatingJavaTypeinstances; needed to allow modules to add more custom type handling (mostly to support types of non-Java JVM languages)protected final TypeResolverProviderprotected final Class<?>View to use for filtering out properties to serialize or deserialize.protected static final ConfigOverrideFields inherited from class tools.jackson.databind.cfg.MapperConfig
_base, _mapperFeatures, EMPTY_FORMAT, EMPTY_INCLUDE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMapperConfigBase(MapperBuilder<?, ?> b, long mapperFeatures, TypeFactory tf, ClassIntrospector classIntr, MixInHandler mixins, SubtypeResolver str, ConfigOverrides configOverrides, ContextAttributes defaultAttrs, RootNameLookup rootNames) Constructor used when creating a new instance (compared to that of creating fluent copies)protectedMapperConfigBase(MapperConfigBase<CFG, T> src) Pass-through constructor used when no changes are needed to the base class.protectedMapperConfigBase(MapperConfigBase<CFG, T> src, Class<?> view) protectedMapperConfigBase(MapperConfigBase<CFG, T> src, BaseSettings base) protectedMapperConfigBase(MapperConfigBase<CFG, T> src, ContextAttributes attr) protectedMapperConfigBase(MapperConfigBase<CFG, T> src, DatatypeFeatures datatypeFeatures) protectedMapperConfigBase(MapperConfigBase<CFG, T> src, PropertyName rootName) -
Method Summary
Modifier and TypeMethodDescription_createConverter(Annotated annotated, Object converterDef) protected DatatypeFeaturesprotected abstract T_with(DatatypeFeatures dtFeatures) protected abstract T_withBase(BaseSettings newBase) Accessor for getting a newClassIntrospectorinstance initialized for per-call usage (with possible local caching)final JavaTypeconstructType(Class<?> cls) Helper method that will constructJavaTypefor given raw class.final JavaTypeconstructType(TypeReference<?> valueTypeRef) Helper method that will constructJavaTypefor given type reference This is a simple short-cut for:final ConfigOverridefindConfigOverride(Class<?> type) Accessor for findingConfigOverrideto use for properties of given type, if any exist; or return `null` if not.final Class<?>findMixInClassFor(Class<?> cls) Method that will check if there are "mix-in" classes (with mix-in annotations) for given classfindRootName(DatabindContext ctxt, Class<?> rawRootType) findRootName(DatabindContext ctxt, JavaType rootType) final Class<?>Accessor for finding currently active view, if any (null if none)final ContextAttributesMethod for accessing per-instance shared (baseline/default) attribute values; these are used as the basis for per-call attributes.final ConfigOverridegetConfigOverride(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.final DatatypeFeaturesfinal JsonInclude.ValuegetDefaultInclusion(Class<?> baseType, 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 byMapperConfig.getDefaultPropertyInclusion().Accessor for the baseline merge info used as the global baseline, not considering possible per-type overrides.getDefaultMergeable(Class<?> baseType) Accessor for the baseline merge info used for given type, including global defaults if no type-specific overrides defined.final JsonSetter.ValueAccessor for the baseline setter info used as the global baseline, not considering possible per-type overrides.final JsonFormat.ValuegetDefaultPropertyFormat(Class<?> type) 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).getDefaultPropertyIgnorals(Class<?> type) Accessor for default property ignorals to use, if any, for given base type, based on config overrides settings (seeMapperConfig.findConfigOverride(Class)).getDefaultPropertyIgnorals(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".final JsonInclude.ValueAccessor for default property inclusion to use for serialization, used unless overridden by per-type or per-property overrides.final JsonInclude.ValuegetDefaultPropertyInclusion(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 byMapperConfig.getDefaultPropertyInclusion().getDefaultPropertyInclusions(Class<?> baseType, AnnotatedClass actualClass) Helper method that may be called to see if there are property inclusion definitions from annotations (viaAnnotatedClass).final VisibilityCheckerAccessor for object used for determining whether specific property elements (method, constructors, fields) can be auto-detected based on their visibility (access modifiers).final VisibilityCheckergetDefaultVisibilityChecker(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).final PropertyNamefinal SubtypeResolverAccessor for object used for finding out all reachable subtypes for supertypes; needed when a logical type name is used instead of class name (or custom scheme).final TypeFactorybooleanMethod that may be called for optimization purposes, to see if calls to mix-in resolver may be avoided.final booleanisEnabled(DatatypeFeature feature) Accessor for checking whether giveDatatypeFeatureis enabled or not.final intTest-only method -- does not reflect possibly open-ended set that external mix-in resolver might provide.snapshot()Method called to create a new, non-shared copy, to be used by differentObjectMapperinstance, and one that should not be connected to this instance, if resolver has mutable state.with(DateFormat df) Method for constructing and returning a new instance with differentDateFormatto use.final TMethod for constructing and returning a new instance with different defaultLocaleto use for formatting.final TMethod for constructing and returning a new instance with different defaultTimeZoneto use for formatting of date values.final Twith(Base64Variant base64) Method for constructing and returning a new instance with different defaultBase64Variantto use with base64-encoded binary values.with(CacheProvider provider) abstract Twith(ContextAttributes attrs) Method for constructing an instance that has specified contextual attributes.final Twith(DatatypeFeature feature) Fluent factory method that will return a configuration object instance with specified feature enabled: this may bethisinstance (if no changes effected), or a newly constructed instance.final Twith(DatatypeFeature feature, boolean state) Fluent factory method that will construct and return a new configuration object instance with specified features disabled.final Twith(TypeResolverBuilder<?> trb) Method for constructing and returning a new instance with differentTypeResolverBuilderto use.final TFluent factory method that will construct a new instance with specifiedJsonNodeFactory.withAttribute(Object key, Object value) Method for constructing an instance that has specified value for attribute for given key.withAttributes(Map<?, ?> attributes) Method for constructing an instance that has only specified attributes, removing any attributes that exist before the call.final TwithFeatures(DatatypeFeature... features) Fluent factory method that will return a configuration object instance with specified features enabled: this may bethisinstance (if no changes effected), or a newly constructed instance.final Twithout(DatatypeFeature feature) Fluent factory method that will return a configuration object instance with specified feature disabled: this may bethisinstance (if no changes effected), or a newly constructed instance.withoutAttribute(Object key) Method for constructing an instance that has no value for attribute for given key.final TwithoutFeatures(DatatypeFeature... features) Fluent factory method that will return a configuration object instance with specified features disabled: this may bethisinstance (if no changes effected), or a newly constructed instance.withRootName(String rootName) abstract TwithRootName(PropertyName rootName) Method for constructing and returning a new instance with different root name to use (none, if null).abstract TMethod for constructing and returning a new instance with different view to use.Methods inherited from class tools.jackson.databind.cfg.MapperConfig
canOverrideAccessModifiers, compileString, getAccessorNaming, getAnnotationIntrospector, getBase64Variant, getCacheProvider, getConstructorDetector, getDateFormat, getDefaultInclusion, getDefaultPropertyInclusion, getDefaultTyper, getEnumNamingStrategy, getHandlerInstantiator, getLocale, getNodeFactory, getPolymorphicTypeValidator, getPropertyNamingStrategy, getTimeZone, hasExplicitTimeZone, isAnnotationProcessingEnabled, isEnabled, shouldSortPropertiesAlphabetically, typeIdResolverInstance, typeResolverBuilderInstance, useRootWrapping
-
Field Details
-
EMPTY_OVERRIDE
-
_typeFactory
Specific factory used for creatingJavaTypeinstances; needed to allow modules to add more custom type handling (mostly to support types of non-Java JVM languages) -
_classIntrospector
-
_typeResolverProvider
- Since:
- 3.0
-
_subtypeResolver
Registered concrete subtypes that can be used instead of (or in addition to) ones declared using annotations.Note that instances are stateful and as such may need to be copied, and may NOT be demoted down to
BaseSettings. -
_mixIns
Mix-in annotation mappings to use, if any. -
_rootName
Explicitly defined root name to use, if any; if empty String, will disable root-name wrapping; if null, will use defaults -
_view
View to use for filtering out properties to serialize or deserialize. Null if none (will also be assigned null ifObject.classis defined), meaning that all properties are to be included. -
_attributes
Contextual attributes accessible (get and set) during processing, on per-call basis. -
_rootNames
Simple cache used for finding out possible root name for root name wrapping.Note that instances are stateful (for caching) and as such may need to be copied, and may NOT be demoted down to
BaseSettings. -
_configOverrides
Configuration overrides to apply, keyed by type of property. -
_datatypeFeatures
Set ofDatatypeFeatures enabled.
-
-
Constructor Details
-
MapperConfigBase
protected MapperConfigBase(MapperBuilder<?, ?> b, long mapperFeatures, TypeFactory tf, ClassIntrospector classIntr, MixInHandler mixins, SubtypeResolver str, ConfigOverrides configOverrides, ContextAttributes defaultAttrs, RootNameLookup rootNames) Constructor used when creating a new instance (compared to that of creating fluent copies) -
MapperConfigBase
Pass-through constructor used when no changes are needed to the base class. -
MapperConfigBase
-
MapperConfigBase
-
MapperConfigBase
-
MapperConfigBase
-
MapperConfigBase
-
-
Method Details
-
_withBase
-
_with
-
_datatypeFeatures
-
with
Fluent factory method that will return a configuration object instance with specified feature enabled: this may bethisinstance (if no changes effected), or a newly constructed instance. -
withFeatures
Fluent factory method that will return a configuration object instance with specified features enabled: this may bethisinstance (if no changes effected), or a newly constructed instance. -
without
Fluent factory method that will return a configuration object instance with specified feature disabled: this may bethisinstance (if no changes effected), or a newly constructed instance. -
withoutFeatures
Fluent factory method that will return a configuration object instance with specified features disabled: this may bethisinstance (if no changes effected), or a newly constructed instance. -
with
Fluent factory method that will construct and return a new configuration object instance with specified features disabled. -
with
Method for constructing an instance that has specified contextual attributes. -
withAttributes
Method for constructing an instance that has only specified attributes, removing any attributes that exist before the call. -
withAttribute
Method for constructing an instance that has specified value for attribute for given key. -
withoutAttribute
Method for constructing an instance that has no value for attribute for given key. -
with
Method for constructing and returning a new instance with differentTypeResolverBuilderto use. -
with
- Since:
- 2.16
-
with
Fluent factory method that will construct a new instance with specifiedJsonNodeFactory. -
with
Method for constructing and returning a new instance with different defaultBase64Variantto use with base64-encoded binary values. -
with
Method for constructing and returning a new instance with differentDateFormatto use.NOTE: non-final since
SerializationConfigneeds to override this -
with
Method for constructing and returning a new instance with different defaultLocaleto use for formatting. -
with
Method for constructing and returning a new instance with different defaultTimeZoneto use for formatting of date values. -
withRootName
Method 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.- 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.
-
withRootName
-
withView
Method for constructing and returning a new instance with different view to use. -
getTypeFactory
- Specified by:
getTypeFactoryin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
classIntrospectorInstance
Description copied from class:MapperConfigAccessor for getting a newClassIntrospectorinstance initialized for per-call usage (with possible local caching)- Specified by:
classIntrospectorInstancein classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getTypeResolverProvider
- Specified by:
getTypeResolverProviderin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getSubtypeResolver
Accessor for object used for finding out all reachable subtypes for supertypes; needed when a logical type name is used instead of class name (or custom scheme).- Specified by:
getSubtypeResolverin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
constructType
Description copied from class:MapperConfigHelper method that will constructJavaTypefor given raw class. This is a simple short-cut for:getTypeFactory().constructType(cls);- Specified by:
constructTypein classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
constructType
Description copied from class:MapperConfigHelper method that will constructJavaTypefor given type reference This is a simple short-cut for:getTypeFactory().constructType(valueTypeRef);- Specified by:
constructTypein classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
isEnabled
Description copied from class:MapperConfigAccessor for checking whether giveDatatypeFeatureis enabled or not.- Specified by:
isEnabledin classMapperConfig<T extends MapperConfigBase<CFG,T>> - Parameters:
feature- Feature to check- Returns:
- True if feature is enabled; false otherwise
-
getDatatypeFeatures
- Specified by:
getDatatypeFeaturesin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getFullRootName
-
getActiveView
Description copied from class:MapperConfigAccessor for finding currently active view, if any (null if none)- Specified by:
getActiveViewin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getAttributes
Description copied from class:MapperConfigMethod for accessing per-instance shared (baseline/default) attribute values; these are used as the basis for per-call attributes.- Specified by:
getAttributesin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getConfigOverride
Description copied from class:MapperConfigAccessor 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.
- Specified by:
getConfigOverridein classMapperConfig<T extends MapperConfigBase<CFG,T>> - Returns:
- Override object to use for the type, never null (but may be empty)
-
findConfigOverride
Description copied from class:MapperConfigAccessor 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.
- Specified by:
findConfigOverridein classMapperConfig<T extends MapperConfigBase<CFG,T>> - Returns:
- Override object to use for the type, if defined; null if none.
-
getDefaultPropertyInclusion
Description copied from class:MapperConfigAccessor for default property inclusion to use for serialization, used unless overridden by per-type or per-property overrides.- Specified by:
getDefaultPropertyInclusionin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getDefaultPropertyInclusion
Description copied from class:MapperConfigAccessor 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 byMapperConfig.getDefaultPropertyInclusion().- Specified by:
getDefaultPropertyInclusionin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getDefaultInclusion
Description copied from class:MapperConfigAccessor 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 byMapperConfig.getDefaultPropertyInclusion().- Specified by:
getDefaultInclusionin classMapperConfig<T extends MapperConfigBase<CFG,T>> - Parameters:
baseType- Type of the instance containing the targeted property.propertyType- Type of the property to look up inclusion setting for.
-
getDefaultPropertyFormat
Description copied from class:MapperConfigAccessor 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).- Specified by:
getDefaultPropertyFormatin classMapperConfig<T extends MapperConfigBase<CFG,T>> - Returns:
- (non-null) Format settings to use, possibly `JsonFormat.Value.empty()`
-
getDefaultPropertyIgnorals
Description copied from class:MapperConfigAccessor for default property ignorals to use, if any, for given base type, based on config overrides settings (seeMapperConfig.findConfigOverride(Class)).- Specified by:
getDefaultPropertyIgnoralsin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getDefaultPropertyIgnorals
public final JsonIgnoreProperties.Value getDefaultPropertyIgnorals(Class<?> baseType, AnnotatedClass actualClass) Description copied from class:MapperConfigHelper 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.- Specified by:
getDefaultPropertyIgnoralsin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getDefaultPropertyInclusions
public final JsonIncludeProperties.Value getDefaultPropertyInclusions(Class<?> baseType, AnnotatedClass actualClass) Description copied from class:MapperConfigHelper method that may be called to see if there are property inclusion definitions from annotations (viaAnnotatedClass). TODO: config override.- Specified by:
getDefaultPropertyInclusionsin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getDefaultVisibilityChecker
Description copied from class:MapperConfigAccessor 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)- Specified by:
getDefaultVisibilityCheckerin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getDefaultVisibilityChecker
public final VisibilityChecker getDefaultVisibilityChecker(Class<?> baseType, AnnotatedClass actualClass) Description copied from class:MapperConfigAccessor 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 byMapperConfig.getDefaultVisibilityChecker(), but then modified by possible class annotation (seeJsonAutoDetect) and/or per-type config override (seeConfigOverride.getVisibility()).- Specified by:
getDefaultVisibilityCheckerin classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
getDefaultNullHandling
Description copied from class:MapperConfigAccessor for the baseline setter info used as the global baseline, not considering possible per-type overrides.- Specified by:
getDefaultNullHandlingin classMapperConfig<T extends MapperConfigBase<CFG,T>> - Returns:
- Global base settings; never null
-
getDefaultMergeable
Description copied from class:MapperConfigAccessor for the baseline merge info used as the global baseline, not considering possible per-type overrides.- Specified by:
getDefaultMergeablein classMapperConfig<T extends MapperConfigBase<CFG,T>> - Returns:
- Global base settings, if any; `null` if none.
-
getDefaultMergeable
Description copied from class:MapperConfigAccessor for the baseline merge info used for given type, including global defaults if no type-specific overrides defined.- Specified by:
getDefaultMergeablein classMapperConfig<T extends MapperConfigBase<CFG,T>> - Returns:
- Type-specific settings (if any); global defaults (same as
MapperConfig.getDefaultMergeable()) otherwise, if any defined; or `null` if neither defined
-
findRootName
- Specified by:
findRootNamein classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
findRootName
- Specified by:
findRootNamein classMapperConfig<T extends MapperConfigBase<CFG,T>>
-
findMixInClassFor
Method that will check if there are "mix-in" classes (with mix-in annotations) for given class- Specified by:
findMixInClassForin interfaceMixInResolver
-
hasMixIns
public boolean hasMixIns()Description copied from interface:MixInResolverMethod that may be called for optimization purposes, to see if calls to mix-in resolver may be avoided. Return value oftruemeans that it is possible that a mix-in class will be found;falsethat no mix-in will ever be found. In latter case caller can avoid calls altogether.Note that the reason for "empty" resolvers is to use "null object" for simplifying calling code.
- Specified by:
hasMixInsin interfaceMixInResolver- Returns:
- True, if this resolver MAY have mix-ins to apply; false if not (it is "empty")
-
snapshot
Description copied from interface:MixInResolverMethod called to create a new, non-shared copy, to be used by differentObjectMapperinstance, and one that should not be connected to this instance, if resolver has mutable state. If resolver is immutable may simply return `this`.- Specified by:
snapshotin interfaceMixInResolver- Specified by:
snapshotin interfaceSnapshottable<CFG extends ConfigFeature>
-
mixInCount
public final int mixInCount()Test-only method -- does not reflect possibly open-ended set that external mix-in resolver might provide. -
_createConverter
-