public abstract class MapperConfigBase<CFG extends ConfigFeature,T extends MapperConfigBase<CFG,T>> extends MapperConfig<T> implements Serializable
Modifier and Type | Field and Description |
---|---|
protected ContextAttributes |
_attributes
Contextual attributes accessible (get and set) during processing,
on per-call basis.
|
protected ConfigOverrides |
_configOverrides
Configuration overrides to apply, keyed by type of property.
|
protected SimpleMixInResolver |
_mixIns
Mix-in annotation mappings to use, if any: immutable,
cannot be changed once defined.
|
protected PropertyName |
_rootName
Explicitly defined root name to use, if any; if empty
String, will disable root-name wrapping; if null, will
use defaults
|
protected RootNameLookup |
_rootNames
Simple cache used for finding out possible root name for root name
wrapping.
|
protected SubtypeResolver |
_subtypeResolver
Registered concrete subtypes that can be used instead of (or
in addition to) ones declared using annotations.
|
protected Class<?> |
_view
View to use for filtering out properties to serialize
or deserialize.
|
protected static ConfigOverride |
EMPTY_OVERRIDE |
_base, _mapperFeatures, EMPTY_FORMAT, EMPTY_INCLUDE
Modifier | Constructor and Description |
---|---|
protected |
MapperConfigBase(BaseSettings base,
SubtypeResolver str,
SimpleMixInResolver mixins,
RootNameLookup rootNames,
ConfigOverrides configOverrides)
Constructor used when creating a new instance (compared to
that of creating fluent copies)
|
protected |
MapperConfigBase(MapperConfigBase<CFG,T> src)
Pass-through constructor used when no changes are needed to the
base class.
|
protected |
MapperConfigBase(MapperConfigBase<CFG,T> src,
BaseSettings base) |
protected |
MapperConfigBase(MapperConfigBase<CFG,T> src,
Class<?> view) |
protected |
MapperConfigBase(MapperConfigBase<CFG,T> src,
ContextAttributes attr) |
protected |
MapperConfigBase(MapperConfigBase<CFG,T> src,
int mapperFeatures) |
protected |
MapperConfigBase(MapperConfigBase<CFG,T> src,
PropertyName rootName) |
protected |
MapperConfigBase(MapperConfigBase<CFG,T> src,
SimpleMixInResolver mixins) |
protected |
MapperConfigBase(MapperConfigBase<CFG,T> src,
SubtypeResolver str) |
protected |
MapperConfigBase(MapperConfigBase<CFG,T> src,
SubtypeResolver str,
SimpleMixInResolver mixins,
RootNameLookup rootNames,
ConfigOverrides configOverrides)
Copy constructor usually called to make a copy for use by
ObjectMapper that is copied.
|
Modifier and Type | Method and Description |
---|---|
protected abstract T |
_withBase(BaseSettings newBase) |
protected abstract T |
_withMapperFeatures(int mapperFeatures) |
ClassIntrospector.MixInResolver |
copy()
Method called to create a new, non-shared copy, to be used by different
ObjectMapper instance, and one that should not be connected
to this instance, if resolver has mutable state. |
ConfigOverride |
findConfigOverride(Class<?> type)
Accessor for finding
ConfigOverride to use for
properties of given type, if any exist; or return `null` if not. |
Class<?> |
findMixInClassFor(Class<?> cls)
Method that will check if there are "mix-in" classes (with mix-in
annotations) for given class
|
PropertyName |
findRootName(Class<?> rawRootType) |
PropertyName |
findRootName(JavaType rootType) |
Class<?> |
getActiveView()
Accessor for finding currently active view, if any (null if none)
|
ContextAttributes |
getAttributes()
Method for accessing per-instance shared (baseline/default)
attribute values; these are used as the basis for per-call
attributes.
|
ConfigOverride |
getConfigOverride(Class<?> type)
Accessor for finding
ConfigOverride to use for
properties of given type, if any exist; or if none, return an immutable
"empty" instance with no overrides. |
JsonInclude.Value |
getDefaultInclusion(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 by MapperConfig.getDefaultPropertyInclusion() . |
Boolean |
getDefaultMergeable()
Accessor for the baseline merge info used as the global baseline,
not considering possible per-type overrides.
|
Boolean |
getDefaultMergeable(Class<?> baseType)
Accessor for the baseline merge info used for given type, including global
defaults if no type-specific overrides defined.
|
JsonFormat.Value |
getDefaultPropertyFormat(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).
|
JsonIgnoreProperties.Value |
getDefaultPropertyIgnorals(Class<?> type)
Accessor for default property ignorals to use, if any, for given base type,
based on config overrides settings (see
MapperConfig.findConfigOverride(Class) ). |
JsonIgnoreProperties.Value |
getDefaultPropertyIgnorals(Class<?> baseType,
AnnotatedClass actualClass)
Helper method that may be called to see if there are property ignoral
definitions from annotations (via
AnnotatedClass ) or through
"config overrides". |
JsonInclude.Value |
getDefaultPropertyInclusion()
Accessor for default property inclusion to use for serialization,
used unless overridden by per-type or per-property overrides.
|
JsonInclude.Value |
getDefaultPropertyInclusion(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 by MapperConfig.getDefaultPropertyInclusion() . |
JsonIncludeProperties.Value |
getDefaultPropertyInclusions(Class<?> baseType,
AnnotatedClass actualClass)
Helper method that may be called to see if there are property inclusion
definitions from annotations (via
AnnotatedClass ). |
JsonSetter.Value |
getDefaultSetterInfo()
Accessor for the baseline setter info used as the global baseline,
not considering possible per-type overrides.
|
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).
|
VisibilityChecker<?> |
getDefaultVisibilityChecker(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).
|
PropertyName |
getFullRootName() |
String |
getRootName()
Deprecated.
Since 2.6 use
getFullRootName() instead. |
SubtypeResolver |
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).
|
int |
mixInCount()
Test-only method -- does not reflect possibly open-ended set that external
mix-in resolver might provide.
|
T |
with(AccessorNamingStrategy.Provider p)
Method for constructing and returning a new instance with different
PropertyNamingStrategy
to use. |
T |
with(AnnotationIntrospector ai)
Method for constructing and returning a new instance with different
AnnotationIntrospector to use (replacing old one). |
T |
with(Base64Variant base64)
Method for constructing and returning a new instance with different
default
Base64Variant to use with base64-encoded binary values. |
T |
with(ClassIntrospector ci)
Method for constructing and returning a new instance with different
ClassIntrospector
to use. |
abstract T |
with(ContextAttributes attrs)
Method for constructing an instance that has specified
contextual attributes.
|
T |
with(DateFormat df)
Method for constructing and returning a new instance with different
DateFormat
to use. |
T |
with(HandlerInstantiator hi)
Method for constructing and returning a new instance with different
HandlerInstantiator
to use. |
T |
with(Locale l)
Method for constructing and returning a new instance with different
default
Locale to use for formatting. |
T |
with(MapperFeature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features enabled.
|
T |
with(MapperFeature feature,
boolean state) |
T |
with(PropertyNamingStrategy pns)
Method for constructing and returning a new instance with different
PropertyNamingStrategy
to use. |
abstract T |
with(SubtypeResolver str)
Method for constructing and returning a new instance with different
SubtypeResolver
to use. |
T |
with(TimeZone tz)
Method for constructing and returning a new instance with different
default
TimeZone to use for formatting of date values. |
T |
with(TypeFactory tf)
Method for constructing and returning a new instance with different
TypeFactory
to use. |
T |
with(TypeResolverBuilder<?> trb)
Method for constructing and returning a new instance with different
TypeResolverBuilder to use. |
T |
withAppendedAnnotationIntrospector(AnnotationIntrospector ai)
Method for constructing and returning a new instance with additional
AnnotationIntrospector appended (as the lowest priority one) |
T |
withAttribute(Object key,
Object value)
Method for constructing an instance that has specified
value for attribute for given key.
|
T |
withAttributes(Map<?,?> attributes)
Method for constructing an instance that has only specified
attributes, removing any attributes that exist before the call.
|
T |
withInsertedAnnotationIntrospector(AnnotationIntrospector ai)
Method for constructing and returning a new instance with additional
AnnotationIntrospector inserted (as the highest priority one) |
T |
without(MapperFeature... features)
Fluent factory method that will construct and return a new configuration
object instance with specified features disabled.
|
T |
withoutAttribute(Object key)
Method for constructing an instance that has no
value for attribute for given key.
|
abstract T |
withRootName(PropertyName rootName)
Method for constructing and returning a new instance with different
root name to use (none, if null).
|
T |
withRootName(String rootName) |
abstract T |
withView(Class<?> view)
Method for constructing and returning a new instance with different
view to use.
|
canOverrideAccessModifiers, collectFeatureDefaults, compileString, constructSpecializedType, constructType, constructType, getAccessorNaming, getAnnotationIntrospector, getBase64Variant, getClassIntrospector, getDateFormat, getDefaultInclusion, getDefaultPropertyInclusion, getDefaultTyper, getHandlerInstantiator, getLocale, getPolymorphicTypeValidator, getPropertyNamingStrategy, getTimeZone, getTypeFactory, hasExplicitTimeZone, hasMapperFeatures, introspectClassAnnotations, introspectClassAnnotations, introspectDirectClassAnnotations, introspectDirectClassAnnotations, isAnnotationProcessingEnabled, isEnabled, shouldSortPropertiesAlphabetically, typeIdResolverInstance, typeResolverBuilderInstance, useRootWrapping
protected static final ConfigOverride EMPTY_OVERRIDE
protected final SimpleMixInResolver _mixIns
protected final SubtypeResolver _subtypeResolver
Note that instances are stateful and as such may need to be copied,
and may NOT be demoted down to BaseSettings
.
protected final PropertyName _rootName
protected final Class<?> _view
Object.class
is defined), meaning that all properties are to be included.protected final ContextAttributes _attributes
protected final RootNameLookup _rootNames
Note that instances are stateful (for caching) and as such may need to be copied,
and may NOT be demoted down to BaseSettings
.
protected final ConfigOverrides _configOverrides
protected MapperConfigBase(BaseSettings base, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)
protected MapperConfigBase(MapperConfigBase<CFG,T> src, SubtypeResolver str, SimpleMixInResolver mixins, RootNameLookup rootNames, ConfigOverrides configOverrides)
protected MapperConfigBase(MapperConfigBase<CFG,T> src)
protected MapperConfigBase(MapperConfigBase<CFG,T> src, BaseSettings base)
protected MapperConfigBase(MapperConfigBase<CFG,T> src, int mapperFeatures)
protected MapperConfigBase(MapperConfigBase<CFG,T> src, SubtypeResolver str)
protected MapperConfigBase(MapperConfigBase<CFG,T> src, PropertyName rootName)
protected MapperConfigBase(MapperConfigBase<CFG,T> src, Class<?> view)
protected MapperConfigBase(MapperConfigBase<CFG,T> src, SimpleMixInResolver mixins)
protected MapperConfigBase(MapperConfigBase<CFG,T> src, ContextAttributes attr)
protected abstract T _withBase(BaseSettings newBase)
protected abstract T _withMapperFeatures(int mapperFeatures)
public final T with(MapperFeature... features)
with
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final T without(MapperFeature... features)
without
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final T with(MapperFeature feature, boolean state)
with
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final T with(AnnotationIntrospector ai)
AnnotationIntrospector
to use (replacing old one).
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public final T withAppendedAnnotationIntrospector(AnnotationIntrospector ai)
AnnotationIntrospector
appended (as the lowest priority one)public final T withInsertedAnnotationIntrospector(AnnotationIntrospector ai)
AnnotationIntrospector
inserted (as the highest priority one)public final T with(ClassIntrospector ci)
ClassIntrospector
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T with(ContextAttributes attrs)
public T withAttributes(Map<?,?> attributes)
public T withAttribute(Object key, Object value)
public T withoutAttribute(Object key)
public final T with(TypeFactory tf)
TypeFactory
to use.public final T with(TypeResolverBuilder<?> trb)
TypeResolverBuilder
to use.public final T with(PropertyNamingStrategy pns)
PropertyNamingStrategy
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public final T with(AccessorNamingStrategy.Provider p)
PropertyNamingStrategy
to use.public final T with(HandlerInstantiator hi)
HandlerInstantiator
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public final T with(Base64Variant base64)
Base64Variant
to use with base64-encoded binary values.public T with(DateFormat df)
DateFormat
to use.
NOTE: non-final since SerializationConfig
needs to override this
public final T with(Locale l)
Locale
to use for formatting.public final T with(TimeZone tz)
TimeZone
to use for formatting of date values.public abstract T withRootName(PropertyName rootName)
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
SerializationFeature
to determine if to use wrapping, and annotation
(or default name) for actual root name to use.
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.public abstract T with(SubtypeResolver str)
SubtypeResolver
to use.
NOTE: make sure to register new instance with ObjectMapper
if directly calling this method.
public abstract T withView(Class<?> view)
public final SubtypeResolver getSubtypeResolver()
getSubtypeResolver
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
@Deprecated public final String getRootName()
getFullRootName()
instead.public final PropertyName getFullRootName()
public final Class<?> getActiveView()
MapperConfig
getActiveView
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final ContextAttributes getAttributes()
MapperConfig
getAttributes
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final ConfigOverride getConfigOverride(Class<?> type)
MapperConfig
ConfigOverride
to 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.
getConfigOverride
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final ConfigOverride findConfigOverride(Class<?> type)
MapperConfig
ConfigOverride
to 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.
findConfigOverride
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final JsonInclude.Value getDefaultPropertyInclusion()
MapperConfig
getDefaultPropertyInclusion
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final JsonInclude.Value getDefaultPropertyInclusion(Class<?> baseType)
MapperConfig
MapperConfig.getDefaultPropertyInclusion()
.getDefaultPropertyInclusion
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final JsonInclude.Value getDefaultInclusion(Class<?> baseType, Class<?> propertyType)
MapperConfig
MapperConfig.getDefaultPropertyInclusion()
.getDefaultInclusion
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
baseType
- Type of the instance containing the targeted property.propertyType
- Type of the property to look up inclusion setting for.public final JsonFormat.Value getDefaultPropertyFormat(Class<?> type)
MapperConfig
getDefaultPropertyFormat
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final JsonIgnoreProperties.Value getDefaultPropertyIgnorals(Class<?> type)
MapperConfig
MapperConfig.findConfigOverride(Class)
).getDefaultPropertyIgnorals
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final JsonIgnoreProperties.Value getDefaultPropertyIgnorals(Class<?> baseType, AnnotatedClass actualClass)
MapperConfig
AnnotatedClass
) or through
"config overrides". If both exist, config overrides have precedence
over class annotations.getDefaultPropertyIgnorals
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final JsonIncludeProperties.Value getDefaultPropertyInclusions(Class<?> baseType, AnnotatedClass actualClass)
MapperConfig
AnnotatedClass
).
TODO: config override.getDefaultPropertyInclusions
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final VisibilityChecker<?> getDefaultVisibilityChecker()
MapperConfig
JsonAutoDetect
annotation)getDefaultVisibilityChecker
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final VisibilityChecker<?> getDefaultVisibilityChecker(Class<?> baseType, AnnotatedClass actualClass)
MapperConfig
MapperConfig.getDefaultVisibilityChecker()
, but
then modified by possible class annotation (see JsonAutoDetect
)
and/or per-type config override (see ConfigOverride.getVisibility()
).getDefaultVisibilityChecker
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final JsonSetter.Value getDefaultSetterInfo()
MapperConfig
getDefaultSetterInfo
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public Boolean getDefaultMergeable()
MapperConfig
getDefaultMergeable
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public Boolean getDefaultMergeable(Class<?> baseType)
MapperConfig
getDefaultMergeable
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
MapperConfig.getDefaultMergeable()
) otherwise, if any defined; or `null`
if neither definedpublic PropertyName findRootName(JavaType rootType)
findRootName
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public PropertyName findRootName(Class<?> rawRootType)
findRootName
in class MapperConfig<T extends MapperConfigBase<CFG,T>>
public final Class<?> findMixInClassFor(Class<?> cls)
findMixInClassFor
in interface ClassIntrospector.MixInResolver
public ClassIntrospector.MixInResolver copy()
ClassIntrospector.MixInResolver
ObjectMapper
instance, and one that should not be connected
to this instance, if resolver has mutable state.
If resolver is immutable may simply return `this`.copy
in interface ClassIntrospector.MixInResolver
public final int mixInCount()
Copyright © 2021 JBoss by Red Hat. All rights reserved.