Top Description Fields Constructors Methods
tools.jackson.databind

public final Class SerializationConfig

extends MapperConfigBase<SerializationFeature, SerializationConfig>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.text.DateFormat, tools.jackson.core.*, tools.jackson.core.util.Instantiatable, tools.jackson.databind.cfg.*, tools.jackson.databind.introspect.Annotated, .ClassIntrospector, .MixInHandler, tools.jackson.databind.jsontype.SubtypeResolver, tools.jackson.databind.ser.FilterProvider, .SerializerFactory, tools.jackson.databind.type.TypeFactory, tools.jackson.databind.util.Converter, .RootNameLookup

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.

Field Summary

Modifier and TypeField and Description
protected final PrettyPrinter
_defaultPrettyPrinter

If "default pretty-printing" is enabled, it will create the instance from this blueprint object.

protected final FilterProvider
_filterProvider

Object used for resolving filter ids to filter instances.

protected final int
protected final int
protected final int
private static final long
Inherited from tools.jackson.databind.cfg.MapperConfigBase:
_attributes_classIntrospector_configOverrides_datatypeFeatures_mixIns_rootName_rootNames_subtypeResolver_typeFactory_typeResolverProvider_viewEMPTY_OVERRIDE

Constructor Summary

AccessConstructor and Description
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)

private
SerializationConfig(SerializationConfig src, int serFeatures, int streamWriteFeatures, int formatWriteFeatures)

private
private
private
private
protected
protected
protected

Method Summary

Modifier and TypeMethod and Description
protected final SerializationConfig
protected final SerializationConfig
public PrettyPrinter
public Converter<Object, Object>
public PrettyPrinter
getDefaultPrettyPrinter()

Accessor for configured blueprint "default" PrettyPrinter to use, if default pretty-printing is enabled.

public FilterProvider
getFilterProvider()

Method for getting provider used for locating filters given id (which is usually provided with filter annotations).

public int
public final int
public int
public final boolean
public final boolean
hasSerializationFeatures(int featureMask)

"Bulk" access method for checking that all features specified by mask are enabled.

public final boolean

Returns:

True if feature is enabled; false otherwise
isEnabled
(SerializationFeature
Feature to check
feature
)

Accessor for checking whether give SerializationFeature is enabled or not.

public final boolean
isEnabled(StreamWriteFeature f)

Accessor method that first checks if we have any overrides for feature, and only if not, checks state of passed-in factory.

public boolean
useRootWrapping()

Implements abstract tools.jackson.databind.cfg.MapperConfig.useRootWrapping.

Accessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.

public SerializationConfig
with(ContextAttributes attrs)

Implements abstract tools.jackson.databind.cfg.MapperConfigBase.with.

Method for constructing an instance that has specified contextual attributes.

public SerializationConfig
with(DateFormat df)

Overrides tools.jackson.databind.cfg.MapperConfigBase.with.

In addition to constructing instance with specified date format, will enable or disable DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS (enable if format set as null; disable if non-null)

public SerializationConfig
with(SerializationFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

public SerializationConfig
with(SerializationFeature first, SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

public SerializationConfig
with(StreamWriteFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

public SerializationConfig
with(FormatFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

public SerializationConfig
public SerializationConfig
withFeatures(SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

public SerializationConfig
withFeatures(StreamWriteFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

public SerializationConfig
withFeatures(FormatFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

public SerializationConfig
withFilters(FilterProvider filterProvider)

public SerializationConfig
without(SerializationFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

public SerializationConfig
without(SerializationFeature first, SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

public SerializationConfig
without(StreamWriteFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

public SerializationConfig
without(FormatFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

public SerializationConfig
withoutFeatures(SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

public SerializationConfig
withoutFeatures(StreamWriteFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

public SerializationConfig
withoutFeatures(FormatFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

public SerializationConfig
withRootName(PropertyName rootName)

Implements abstract tools.jackson.databind.cfg.MapperConfigBase.withRootName.

Method for constructing and returning a new instance with different root name to use (none, if null).

public SerializationConfig
withView(Class<?> view)

Implements abstract tools.jackson.databind.cfg.MapperConfigBase.withView.

Method for constructing and returning a new instance with different view to use.

Inherited from tools.jackson.databind.cfg.MapperConfigBase:
_createConverter_datatypeFeaturesclassIntrospectorInstanceconstructTypeconstructTypefindConfigOverridefindMixInClassForfindRootNamefindRootNamegetActiveViewgetAttributesgetConfigOverridegetDatatypeFeaturesgetDefaultInclusiongetDefaultMergeablegetDefaultMergeablegetDefaultNullHandlinggetDefaultPropertyFormatgetDefaultPropertyIgnoralsgetDefaultPropertyIgnoralsgetDefaultPropertyInclusiongetDefaultPropertyInclusiongetDefaultPropertyInclusionsgetDefaultVisibilityCheckergetDefaultVisibilityCheckergetFullRootNamegetSubtypeResolvergetTypeFactorygetTypeResolverProviderhasMixInsisEnabledmixInCountsnapshotwithwithwithwithwithwithwithwithwithAttributewithAttributeswithFeatureswithoutwithoutAttributewithoutFeatureswithRootName

Field Detail

_defaultPrettyPrinterback to summary
protected final PrettyPrinter _defaultPrettyPrinter

If "default pretty-printing" is enabled, it will create the instance from this blueprint object.

_filterProviderback to summary
protected final FilterProvider _filterProvider

Object used for resolving filter ids to filter instances. Non-null if explicitly defined; null by default.

_formatWriteFeaturesback to summary
protected final int _formatWriteFeatures

States of tools.jackson.core.FormatFeatures to enable/disable.

_serFeaturesback to summary
protected final int _serFeatures

Set of SerializationFeatures enabled.

_streamWriteFeaturesback to summary
protected final int _streamWriteFeatures

States of tools.jackson.core.StreamWriteFeatures to enable/disable.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides tools.jackson.databind.cfg.MapperConfig.serialVersionUID.

Constructor Detail

SerializationConfigback to summary
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
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, int serFeatures, int streamWriteFeatures, int formatWriteFeatures)
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, BaseSettings base)
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, FilterProvider filters)
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, Class<?> view)
SerializationConfigback to summary
private SerializationConfig(SerializationConfig src, PropertyName rootName)
SerializationConfigback to summary
protected SerializationConfig(SerializationConfig src, ContextAttributes attrs)
SerializationConfigback to summary
protected SerializationConfig(SerializationConfig src, PrettyPrinter defaultPP)
SerializationConfigback to summary
protected SerializationConfig(SerializationConfig src, DatatypeFeatures dtFeatures)

Method Detail

_withback to summary
protected final SerializationConfig _with(DatatypeFeatures dtFeatures)

Implements abstract tools.jackson.databind.cfg.MapperConfigBase._with.

Annotations
@Override
_withBaseback to summary
protected final SerializationConfig _withBase(BaseSettings newBase)

Implements abstract tools.jackson.databind.cfg.MapperConfigBase._withBase.

Annotations
@Override
constructDefaultPrettyPrinterback to summary
public PrettyPrinter constructDefaultPrettyPrinter()
findSerializationConverterback to summary
public Converter<Object, Object> findSerializationConverter(Annotated ann)
getDefaultPrettyPrinterback to summary
public PrettyPrinter 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.

getFilterProviderback to summary
public FilterProvider 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 for ObjectWriter (or if serialization directly called from ObjectMapper)

getFormatWriteFeaturesback to summary
public int getFormatWriteFeatures()
Since
3.0
getSerializationFeaturesback to summary
public final int getSerializationFeatures()
getStreamWriteFeaturesback to summary
public int getStreamWriteFeatures()
Since
3.0
hasFormatFeatureback to summary
public final boolean hasFormatFeature(FormatFeature f)
hasSerializationFeaturesback to summary
public final boolean hasSerializationFeatures(int featureMask)

"Bulk" access method for checking that all features specified by mask are enabled.

isEnabledback to summary
public final boolean isEnabled(SerializationFeature feature)

Accessor for checking whether give SerializationFeature is enabled or not.

Parameters
feature:SerializationFeature

Feature to check

Returns:boolean

True if feature is enabled; false otherwise

isEnabledback to summary
public final boolean isEnabled(StreamWriteFeature f)

Accessor method that first checks if we have any overrides for feature, and only if not, checks state of passed-in factory.

useRootWrappingback to summary
public boolean useRootWrapping()

Implements abstract tools.jackson.databind.cfg.MapperConfig.useRootWrapping.

Doc from tools.jackson.databind.cfg.MapperConfig.useRootWrapping.

Accessor for checking whether configuration indicates that "root wrapping" (use of an extra property/name pair at root level) is expected or not.

Annotations
@Override
withback to summary
public SerializationConfig with(ContextAttributes attrs)

Implements abstract tools.jackson.databind.cfg.MapperConfigBase.with.

Doc from tools.jackson.databind.cfg.MapperConfigBase.with.

Method for constructing an instance that has specified contextual attributes.

Annotations
@Override
withback to summary
public SerializationConfig with(DateFormat df)

Overrides tools.jackson.databind.cfg.MapperConfigBase.with.

In addition to constructing instance with specified date format, will enable or disable DateTimeFeature.WRITE_DATES_AS_TIMESTAMPS (enable if format set as null; disable if non-null)

Annotations
@Override
withback to summary
public SerializationConfig with(SerializationFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

withback to summary
public SerializationConfig with(SerializationFeature first, SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

withback to summary
public SerializationConfig with(StreamWriteFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

withback to summary
public SerializationConfig with(FormatFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.

withDefaultPrettyPrinterback to summary
public SerializationConfig withDefaultPrettyPrinter(PrettyPrinter pp)
withFeaturesback to summary
public SerializationConfig withFeatures(SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

withFeaturesback to summary
public SerializationConfig withFeatures(StreamWriteFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

withFeaturesback to summary
public SerializationConfig withFeatures(FormatFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features enabled.

withFiltersback to summary
public SerializationConfig withFilters(FilterProvider filterProvider)
withoutback to summary
public SerializationConfig without(SerializationFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

withoutback to summary
public SerializationConfig without(SerializationFeature first, SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

withoutback to summary
public SerializationConfig without(StreamWriteFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

withoutback to summary
public SerializationConfig without(FormatFeature feature)

Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.

withoutFeaturesback to summary
public SerializationConfig withoutFeatures(SerializationFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

withoutFeaturesback to summary
public SerializationConfig withoutFeatures(StreamWriteFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

withoutFeaturesback to summary
public SerializationConfig withoutFeatures(FormatFeature... features)

Fluent factory method that will construct and return a new configuration object instance with specified features disabled.

withRootNameback to summary
public SerializationConfig withRootName(PropertyName rootName)

Implements abstract tools.jackson.databind.cfg.MapperConfigBase.withRootName.

Doc from tools.jackson.databind.cfg.MapperConfigBase.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 SerializationFeature to determine if to use wrapping, and annotation (or default name) for actual root name to use.

Annotations
@Override
withViewback to summary
public SerializationConfig withView(Class<?> view)

Implements abstract tools.jackson.databind.cfg.MapperConfigBase.withView.

Doc from tools.jackson.databind.cfg.MapperConfigBase.withView.

Method for constructing and returning a new instance with different view to use.

Annotations
@Override