public abstract class MapperConfig<T extends MapperConfig<T>> extends Object implements ClassIntrospector.MixInResolver, Serializable
MapperFeature
.
Small part of implementation is included here by aggregating
BaseSettings
instance that contains configuration
that is shared between different types of instances.
Modifier and Type | Field and Description |
---|---|
protected BaseSettings |
_base
Immutable container object for simple configuration settings.
|
protected int |
_mapperFeatures
Set of shared mapper features enabled.
|
protected static JsonFormat.Value |
EMPTY_FORMAT |
protected static JsonInclude.Value |
EMPTY_INCLUDE |
Modifier | Constructor and Description |
---|---|
protected |
MapperConfig(BaseSettings base,
int mapperFeatures) |
protected |
MapperConfig(MapperConfig<T> src) |
protected |
MapperConfig(MapperConfig<T> src,
BaseSettings base) |
protected |
MapperConfig(MapperConfig<T> src,
int mapperFeatures) |
Modifier and Type | Method and Description |
---|---|
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.
|
static <F extends Enum<F> & ConfigFeature> |
collectFeatureDefaults(Class<F> enumClass)
Method that calculates bit set (flags) of all features that
are enabled by default.
|
SerializableString |
compileString(String src)
Method for constructing a specialized textual object that can typically
be serialized faster than basic
String (depending
on escaping needed if any, char-to-byte encoding if needed). |
JavaType |
constructSpecializedType(JavaType baseType,
Class<?> subclass) |
JavaType |
constructType(Class<?> cls)
Helper method that will construct
JavaType for given
raw class. |
JavaType |
constructType(TypeReference<?> valueTypeRef)
Helper method that will construct
JavaType for given
type reference
This is a simple short-cut for: |
abstract ConfigOverride |
findConfigOverride(Class<?> type)
Accessor for finding
ConfigOverride to use for
properties of given type, if any exist; or return `null` if not. |
abstract PropertyName |
findRootName(Class<?> rawRootType) |
abstract PropertyName |
findRootName(JavaType rootType) |
AccessorNamingStrategy.Provider |
getAccessorNaming() |
abstract Class<?> |
getActiveView()
Accessor for finding currently active view, if any (null if none)
|
AnnotationIntrospector |
getAnnotationIntrospector()
Method for getting
AnnotationIntrospector configured
to introspect annotation values used for configuration. |
abstract ContextAttributes |
getAttributes()
Method for accessing per-instance shared (baseline/default)
attribute values; these are used as the basis for per-call
attributes.
|
Base64Variant |
getBase64Variant()
Method called during deserialization if Base64 encoded content
needs to be decoded.
|
ClassIntrospector |
getClassIntrospector() |
abstract 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. |
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).
|
abstract 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 getDefaultPropertyInclusion() . |
JsonInclude.Value |
getDefaultInclusion(Class<?> baseType,
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 given
defaultIncl |
abstract Boolean |
getDefaultMergeable()
Accessor for the baseline merge info used as the global baseline,
not considering possible per-type overrides.
|
abstract Boolean |
getDefaultMergeable(Class<?> baseType)
Accessor for the baseline merge info used for given type, including global
defaults if no type-specific overrides defined.
|
abstract JsonFormat.Value |
getDefaultPropertyFormat(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.Value |
getDefaultPropertyIgnorals(Class<?> baseType)
Accessor for default property ignorals to use, if any, for given base type,
based on config overrides settings (see
findConfigOverride(Class) ). |
abstract 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". |
abstract JsonInclude.Value |
getDefaultPropertyInclusion()
Accessor for default property inclusion to use for serialization,
used unless overridden by per-type or per-property overrides.
|
abstract 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 getDefaultPropertyInclusion() . |
JsonInclude.Value |
getDefaultPropertyInclusion(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 given
defaultIncl |
abstract 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 ). |
abstract JsonSetter.Value |
getDefaultSetterInfo()
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(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).
|
HandlerInstantiator |
getHandlerInstantiator() |
Locale |
getLocale()
Method for accessing the default
Locale to use
for formatting, unless overridden by local annotations. |
PolymorphicTypeValidator |
getPolymorphicTypeValidator()
Simple accessor for default
PolymorphicTypeValidator to use for
legacy Default Typing methods (ObjectMapper.enableDefaultTyping() )
and annotation based enabling. |
PropertyNamingStrategy |
getPropertyNamingStrategy() |
abstract SubtypeResolver |
getSubtypeResolver() |
TimeZone |
getTimeZone()
Method for accessing the default
TimeZone to use
for formatting, unless overridden by local annotations. |
TypeFactory |
getTypeFactory() |
boolean |
hasExplicitTimeZone()
Method for checking whether a
TimeZone has been explicitly
set for this configuring during construction of ObjectMapper
or if it still has the default timezone/offset (zero-offset, "zulu"). |
boolean |
hasMapperFeatures(int featureMask)
"Bulk" access method for checking that all features specified by
mask are enabled.
|
BeanDescription |
introspectClassAnnotations(Class<?> cls)
Accessor for getting bean description that only contains class
annotations: useful if no getter/setter/creator information is needed.
|
BeanDescription |
introspectClassAnnotations(JavaType type)
Accessor for getting bean description that only contains class
annotations: useful if no getter/setter/creator information is needed.
|
BeanDescription |
introspectDirectClassAnnotations(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.
|
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.
|
boolean |
isAnnotationProcessingEnabled()
Method for determining whether annotation processing is enabled or not
(default settings are typically that it is enabled; must explicitly disable).
|
boolean |
isEnabled(MapperFeature f)
Accessor for simple mapper features (which are shared for
serialization, deserialization)
|
boolean |
shouldSortPropertiesAlphabetically()
Accessor for checking whether default settings for property handling
indicate that properties should be alphabetically ordered or not.
|
TypeIdResolver |
typeIdResolverInstance(Annotated annotated,
Class<? extends TypeIdResolver> resolverClass)
Method that can be called to obtain an instance of
TypeIdResolver of
specified type. |
TypeResolverBuilder<?> |
typeResolverBuilderInstance(Annotated annotated,
Class<? extends TypeResolverBuilder<?>> builderClass)
Method that can be called to obtain an instance of
TypeIdResolver of
specified type. |
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.
|
abstract T |
with(MapperFeature... features)
Method for constructing and returning a new instance with specified
mapper features enabled.
|
abstract T |
with(MapperFeature feature,
boolean state) |
abstract T |
without(MapperFeature... features)
Method for constructing and returning a new instance with specified
mapper features disabled.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
copy, findMixInClassFor
protected static final JsonInclude.Value EMPTY_INCLUDE
protected static final JsonFormat.Value EMPTY_FORMAT
protected final int _mapperFeatures
protected final BaseSettings _base
protected MapperConfig(BaseSettings base, int mapperFeatures)
protected MapperConfig(MapperConfig<T> src, int mapperFeatures)
protected MapperConfig(MapperConfig<T> src, BaseSettings base)
protected MapperConfig(MapperConfig<T> src)
public static <F extends Enum<F> & ConfigFeature> int collectFeatureDefaults(Class<F> enumClass)
public abstract T with(MapperFeature... features)
public abstract T without(MapperFeature... features)
public abstract T with(MapperFeature feature, boolean state)
public final boolean isEnabled(MapperFeature f)
public final boolean hasMapperFeatures(int featureMask)
public final boolean isAnnotationProcessingEnabled()
public final boolean canOverrideAccessModifiers()
public final boolean shouldSortPropertiesAlphabetically()
public abstract boolean useRootWrapping()
public SerializableString compileString(String src)
String
(depending
on escaping needed if any, char-to-byte encoding if needed).src
- Text to representpublic ClassIntrospector getClassIntrospector()
public AnnotationIntrospector getAnnotationIntrospector()
AnnotationIntrospector
configured
to introspect annotation values used for configuration.
Non-final since it is actually overridden by sub-classes (for now?)
public final PropertyNamingStrategy getPropertyNamingStrategy()
public final AccessorNamingStrategy.Provider getAccessorNaming()
public final HandlerInstantiator getHandlerInstantiator()
public final TypeResolverBuilder<?> getDefaultTyper(JavaType baseType)
public abstract SubtypeResolver getSubtypeResolver()
public PolymorphicTypeValidator getPolymorphicTypeValidator()
PolymorphicTypeValidator
to use for
legacy Default Typing methods (ObjectMapper.enableDefaultTyping()
)
and annotation based enabling.
Since 2.11 will also check MapperFeature.BLOCK_UNSAFE_POLYMORPHIC_BASE_TYPES
to possibly override default to more restrictive implementation, see
DefaultBaseTypeLimitingValidator
).
public final TypeFactory getTypeFactory()
public final JavaType constructType(Class<?> cls)
JavaType
for given
raw class.
This is a simple short-cut for:
getTypeFactory().constructType(cls);
public final JavaType constructType(TypeReference<?> valueTypeRef)
JavaType
for given
type reference
This is a simple short-cut for:
getTypeFactory().constructType(valueTypeRef);
public JavaType constructSpecializedType(JavaType baseType, Class<?> subclass)
public BeanDescription introspectClassAnnotations(Class<?> cls)
public BeanDescription introspectClassAnnotations(JavaType type)
public BeanDescription introspectDirectClassAnnotations(Class<?> cls)
public final BeanDescription introspectDirectClassAnnotations(JavaType type)
public abstract ConfigOverride findConfigOverride(Class<?> type)
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.
public abstract ConfigOverride getConfigOverride(Class<?> type)
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.
public abstract JsonInclude.Value getDefaultPropertyInclusion()
public abstract JsonInclude.Value getDefaultPropertyInclusion(Class<?> baseType)
getDefaultPropertyInclusion()
.public JsonInclude.Value getDefaultPropertyInclusion(Class<?> baseType, JsonInclude.Value defaultIncl)
defaultIncl
defaultIncl
- Inclusion setting to return if no overrides found.public abstract JsonInclude.Value getDefaultInclusion(Class<?> baseType, Class<?> propertyType)
getDefaultPropertyInclusion()
.baseType
- Type of the instance containing the targeted property.propertyType
- Type of the property to look up inclusion setting for.public JsonInclude.Value getDefaultInclusion(Class<?> baseType, Class<?> propertyType, JsonInclude.Value defaultIncl)
defaultIncl
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.public abstract JsonFormat.Value getDefaultPropertyFormat(Class<?> baseType)
public abstract JsonIgnoreProperties.Value getDefaultPropertyIgnorals(Class<?> baseType)
findConfigOverride(Class)
).public abstract JsonIgnoreProperties.Value getDefaultPropertyIgnorals(Class<?> baseType, AnnotatedClass actualClass)
AnnotatedClass
) or through
"config overrides". If both exist, config overrides have precedence
over class annotations.public abstract JsonIncludeProperties.Value getDefaultPropertyInclusions(Class<?> baseType, AnnotatedClass actualClass)
AnnotatedClass
).
TODO: config override.public abstract VisibilityChecker<?> getDefaultVisibilityChecker()
JsonAutoDetect
annotation)public abstract VisibilityChecker<?> getDefaultVisibilityChecker(Class<?> baseType, AnnotatedClass actualClass)
getDefaultVisibilityChecker()
, but
then modified by possible class annotation (see JsonAutoDetect
)
and/or per-type config override (see ConfigOverride.getVisibility()
).public abstract JsonSetter.Value getDefaultSetterInfo()
public abstract Boolean getDefaultMergeable()
public abstract Boolean getDefaultMergeable(Class<?> baseType)
getDefaultMergeable()
) otherwise, if any defined; or `null`
if neither definedpublic final DateFormat getDateFormat()
Note that typically DateFormat
instances 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
DeserializationContext
and SerializerProvider
that
take care of cloning and thread-safe reuse.
public final Locale getLocale()
Locale
to use
for formatting, unless overridden by local annotations.
Initially set to Locale.getDefault()
.public final TimeZone getTimeZone()
TimeZone
to use
for formatting, unless overridden by local annotations.
Initially set to TimeZone.getDefault()
.public boolean hasExplicitTimeZone()
TimeZone
has been explicitly
set for this configuring during construction of ObjectMapper
or if it still has the default timezone/offset (zero-offset, "zulu").true
if this configuration has explicitly specified
TimeZone
, or false
if it uses the default
time zonepublic abstract Class<?> getActiveView()
public Base64Variant getBase64Variant()
ObjectWriter
.public abstract ContextAttributes getAttributes()
public abstract PropertyName findRootName(JavaType rootType)
public abstract PropertyName findRootName(Class<?> rawRootType)
public TypeResolverBuilder<?> typeResolverBuilderInstance(Annotated annotated, Class<? extends TypeResolverBuilder<?>> builderClass)
TypeIdResolver
of
specified type.public TypeIdResolver typeIdResolverInstance(Annotated annotated, Class<? extends TypeIdResolver> resolverClass)
TypeIdResolver
of
specified type.Copyright © 2021 JBoss by Red Hat. All rights reserved.