java.lang.Object
tools.jackson.databind.cfg.MapperConfig<T>
tools.jackson.databind.cfg.MapperConfigBase<SerializationFeature,SerializationConfig>
tools.jackson.databind.SerializationConfig
- All Implemented Interfaces:
Serializable
,Snapshottable<MixInResolver>
,MixInResolver
public final class SerializationConfig
extends MapperConfigBase<SerializationFeature,SerializationConfig>
implements Serializable
Object that contains baseline configuration for serialization
process. An instance is owned by
ObjectMapper
, which
passes an immutable instance for serialization process to
SerializationContext
and SerializerFactory
(either directly, or through ObjectWriter
.
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PrettyPrinter
If "default pretty-printing" is enabled, it will create the instance from this blueprint object.protected final FilterProvider
Object used for resolving filter ids to filter instances.protected final int
States ofFormatFeature
s to enable/disable.protected final int
Set ofSerializationFeature
s enabled.protected final int
States ofStreamWriteFeature
s to enable/disable.Fields inherited from class tools.jackson.databind.cfg.MapperConfigBase
_attributes, _classIntrospector, _configOverrides, _datatypeFeatures, _mixIns, _rootName, _rootNames, _subtypeResolver, _typeFactory, _typeResolverProvider, _view, EMPTY_OVERRIDE
Fields inherited from class tools.jackson.databind.cfg.MapperConfig
_base, _mapperFeatures, EMPTY_FORMAT, EMPTY_INCLUDE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionSerializationConfig
(MapperBuilder<?, ?> b, long mapperFeatures, int serFeatures, int streamWriteFeatures, int formatWriteFeatures, ConfigOverrides configOverrides, TypeFactory tf, ClassIntrospector classIntr, MixInHandler mixins, SubtypeResolver str, ContextAttributes defaultAttrs, RootNameLookup rootNames, FilterProvider filterProvider) protected
SerializationConfig
(SerializationConfig src, PrettyPrinter defaultPP) protected
SerializationConfig
(SerializationConfig src, ContextAttributes attrs) protected
SerializationConfig
(SerializationConfig src, DatatypeFeatures dtFeatures) -
Method Summary
Modifier and TypeMethodDescriptionprotected final SerializationConfig
_with
(DatatypeFeatures dtFeatures) protected final SerializationConfig
_withBase
(BaseSettings newBase) Accessor for configured blueprint "default"PrettyPrinter
to use, if default pretty-printing is enabled.Method for getting provider used for locating filters given id (which is usually provided with filter annotations).int
final int
int
final boolean
final boolean
hasSerializationFeatures
(int featureMask) "Bulk" access method for checking that all features specified by mask are enabled.final boolean
Accessor method that first checks if we have any overrides for feature, and only if not, checks state of passed-in factory.final boolean
isEnabled
(SerializationFeature feature) Accessor for checking whether giveSerializationFeature
is enabled or not.boolean
Accessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.with
(DateFormat df) In addition to constructing instance with specified date format, will enable or disableSerializationFeature.WRITE_DATES_AS_TIMESTAMPS
(enable if format set as null; disable if non-null)with
(FormatFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.with
(StreamWriteFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.with
(ContextAttributes attrs) Method for constructing an instance that has specified contextual attributes.with
(SerializationFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.with
(SerializationFeature first, SerializationFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.withFeatures
(FormatFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.withFeatures
(StreamWriteFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.withFeatures
(SerializationFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features enabled.withFilters
(FilterProvider filterProvider) without
(FormatFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.without
(StreamWriteFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.without
(SerializationFeature feature) Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.without
(SerializationFeature first, SerializationFeature... 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
(StreamWriteFeature... features) Fluent factory method that will construct and return a new configuration object instance with specified features disabled.withoutFeatures
(SerializationFeature... 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 tools.jackson.databind.cfg.MapperConfigBase
_datatypeFeatures, classIntrospectorInstance, constructType, constructType, findConfigOverride, findMixInClassFor, findRootName, findRootName, getActiveView, getAttributes, getConfigOverride, getDatatypeFeatures, getDefaultInclusion, getDefaultMergeable, getDefaultMergeable, getDefaultNullHandling, getDefaultPropertyFormat, getDefaultPropertyIgnorals, getDefaultPropertyIgnorals, getDefaultPropertyInclusion, getDefaultPropertyInclusion, getDefaultPropertyInclusions, getDefaultVisibilityChecker, getDefaultVisibilityChecker, getFullRootName, getSubtypeResolver, getTypeFactory, getTypeResolverProvider, hasMixIns, isEnabled, mixInCount, snapshot, with, with, with, with, with, with, with, with, withAttribute, withAttributes, withFeatures, without, withoutAttribute, withoutFeatures, withRootName
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
-
Field Details
-
_filterProvider
Object used for resolving filter ids to filter instances. Non-null if explicitly defined; null by default. -
_defaultPrettyPrinter
If "default pretty-printing" is enabled, it will create the instance from this blueprint object. -
_serFeatures
protected final int _serFeaturesSet ofSerializationFeature
s enabled. -
_streamWriteFeatures
protected final int _streamWriteFeaturesStates ofStreamWriteFeature
s to enable/disable. -
_formatWriteFeatures
protected final int _formatWriteFeaturesStates ofFormatFeature
s to enable/disable.
-
-
Constructor Details
-
SerializationConfig
public SerializationConfig(MapperBuilder<?, ?> b, long mapperFeatures, int serFeatures, int streamWriteFeatures, int formatWriteFeatures, ConfigOverrides configOverrides, TypeFactory tf, ClassIntrospector classIntr, MixInHandler mixins, SubtypeResolver str, ContextAttributes defaultAttrs, RootNameLookup rootNames, FilterProvider filterProvider) - Since:
- 3.0
-
SerializationConfig
-
SerializationConfig
-
SerializationConfig
-
-
Method Details
-
_withBase
- Specified by:
_withBase
in classMapperConfigBase<SerializationFeature,
SerializationConfig>
-
_with
- Specified by:
_with
in classMapperConfigBase<SerializationFeature,
SerializationConfig>
-
withRootName
Description copied from class:MapperConfigBase
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
SerializationFeature
to determine if to use wrapping, and annotation (or default name) for actual root name to use.- Specified by:
withRootName
in classMapperConfigBase<SerializationFeature,
SerializationConfig> - 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:MapperConfigBase
Method for constructing and returning a new instance with different view to use.- Specified by:
withView
in classMapperConfigBase<SerializationFeature,
SerializationConfig>
-
with
Description copied from class:MapperConfigBase
Method for constructing an instance that has specified contextual attributes.- Specified by:
with
in classMapperConfigBase<SerializationFeature,
SerializationConfig>
-
with
In addition to constructing instance with specified date format, will enable or disableSerializationFeature.WRITE_DATES_AS_TIMESTAMPS
(enable if format set as null; disable if non-null)- Overrides:
with
in classMapperConfigBase<SerializationFeature,
SerializationConfig>
-
with
Fluent factory method that will construct and return a new configuration object instance with specified feature 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
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 feature 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. -
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 feature 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. -
withoutFeatures
Fluent factory method that will construct and return a new configuration object instance with specified features disabled. -
withFilters
-
withDefaultPrettyPrinter
-
constructDefaultPrettyPrinter
-
getStreamWriteFeatures
public int getStreamWriteFeatures()- Since:
- 3.0
-
getFormatWriteFeatures
public int getFormatWriteFeatures()- Since:
- 3.0
-
useRootWrapping
public boolean useRootWrapping()Description copied from class:MapperConfig
Accessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.- Specified by:
useRootWrapping
in classMapperConfig<SerializationConfig>
-
isEnabled
Accessor for checking whether giveSerializationFeature
is enabled or not.- Parameters:
feature
- Feature to check- Returns:
- True if feature is enabled; false otherwise
-
isEnabled
Accessor method that first checks if we have any overrides for feature, and only if not, checks state of passed-in factory. -
hasFormatFeature
-
hasSerializationFeatures
public final boolean hasSerializationFeatures(int featureMask) "Bulk" access method for checking that all features specified by mask are enabled. -
getSerializationFeatures
public final int getSerializationFeatures() -
getFilterProvider
Method for getting provider used for locating filters given id (which is usually provided with filter annotations). Will be null if no provided was set forObjectWriter
(or if serialization directly called fromObjectMapper
) -
getDefaultPrettyPrinter
Accessor for configured blueprint "default"PrettyPrinter
to use, if default pretty-printing is enabled.NOTE: returns the "blueprint" instance, and does NOT construct an instance ready to use; call
constructDefaultPrettyPrinter()
if actually usable instance is desired.
-