com.fasterxml.jackson.databind

Class SerializationConfig

    • Field Detail

      • DEFAULT_PRETTY_PRINTER

        protected static final com.fasterxml.jackson.core.PrettyPrinter DEFAULT_PRETTY_PRINTER
      • _filterProvider

        protected final FilterProvider _filterProvider
        Object used for resolving filter ids to filter instances. Non-null if explicitly defined; null by default.
      • _defaultPrettyPrinter

        protected final com.fasterxml.jackson.core.PrettyPrinter _defaultPrettyPrinter
        If "default pretty-printing" is enabled, it will create the instance from this blueprint object.
        Since:
        2.6
      • _ctorDetector

        protected final ConstructorDetector _ctorDetector
        Since:
        2.18 (only in DeserializationConfig from 2.12)
      • _generatorFeatures

        protected final int _generatorFeatures
        States of JsonGenerator.Features to enable/disable.
      • _generatorFeaturesToChange

        protected final int _generatorFeaturesToChange
        Bitflag of JsonGenerator.Features to enable/disable
      • _formatWriteFeatures

        protected final int _formatWriteFeatures
        States of FormatFeatures to enable/disable.
        Since:
        2.7
      • _formatWriteFeaturesToChange

        protected final int _formatWriteFeaturesToChange
        Bitflag of FormatFeatures to enable/disable
        Since:
        2.7
    • Method Detail

      • withRootName

        public SerializationConfig withRootName(PropertyName rootName)
        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 class MapperConfigBase<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.
      • withFeatures

        public SerializationConfig withFeatures(SerializationFeature... features)
        Fluent factory method that will construct and return a new configuration object instance with specified features enabled.
      • without

        public SerializationConfig without(SerializationFeature feature)
        Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.
      • withoutFeatures

        public SerializationConfig withoutFeatures(SerializationFeature... features)
        Fluent factory method that will construct and return a new configuration object instance with specified features disabled.
      • with

        public SerializationConfig with(com.fasterxml.jackson.core.JsonGenerator.Feature feature)
        Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.
        Since:
        2.5
      • withFeatures

        public SerializationConfig withFeatures(com.fasterxml.jackson.core.JsonGenerator.Feature... features)
        Fluent factory method that will construct and return a new configuration object instance with specified features enabled.
        Since:
        2.5
      • without

        public SerializationConfig without(com.fasterxml.jackson.core.JsonGenerator.Feature feature)
        Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.
        Since:
        2.5
      • withoutFeatures

        public SerializationConfig withoutFeatures(com.fasterxml.jackson.core.JsonGenerator.Feature... features)
        Fluent factory method that will construct and return a new configuration object instance with specified features disabled.
        Since:
        2.5
      • with

        public SerializationConfig with(com.fasterxml.jackson.core.FormatFeature feature)
        Fluent factory method that will construct and return a new configuration object instance with specified feature enabled.
        Since:
        2.7
      • withFeatures

        public SerializationConfig withFeatures(com.fasterxml.jackson.core.FormatFeature... features)
        Fluent factory method that will construct and return a new configuration object instance with specified features enabled.
        Since:
        2.7
      • without

        public SerializationConfig without(com.fasterxml.jackson.core.FormatFeature feature)
        Fluent factory method that will construct and return a new configuration object instance with specified feature disabled.
        Since:
        2.7
      • withoutFeatures

        public SerializationConfig withoutFeatures(com.fasterxml.jackson.core.FormatFeature... features)
        Fluent factory method that will construct and return a new configuration object instance with specified features disabled.
        Since:
        2.7
      • withPropertyInclusion

        @Deprecated
        public SerializationConfig withPropertyInclusion(com.fasterxml.jackson.annotation.JsonInclude.Value incl)
        Deprecated. Since 2.9; not needed any more
        Mutant factory method for constructing a new instance with different default inclusion criteria configuration.
        Since:
        2.7
      • withDefaultPrettyPrinter

        public SerializationConfig withDefaultPrettyPrinter(com.fasterxml.jackson.core.PrettyPrinter pp)
        Since:
        2.6
      • constructDefaultPrettyPrinter

        public com.fasterxml.jackson.core.PrettyPrinter constructDefaultPrettyPrinter()
      • initialize

        public void initialize(com.fasterxml.jackson.core.JsonGenerator g)
        Method called by ObjectMapper and ObjectWriter to modify those JsonGenerator.Feature settings that have been configured via this config instance.
        Since:
        2.5
      • 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 class MapperConfig<SerializationConfig>
      • isEnabled

        public final boolean isEnabled(SerializationFeature feature)
        Accessor for checking whether give SerializationFeature is enabled or not.
        Parameters:
        feature - Feature to check
        Returns:
        True if feature is enabled; false otherwise
      • isEnabled

        public final boolean isEnabled(com.fasterxml.jackson.core.JsonGenerator.Feature f,
                                       com.fasterxml.jackson.core.JsonFactory factory)
        Accessor method that first checks if we have any overrides for feature, and only if not, checks state of passed-in factory.
        Since:
        2.5
      • hasSerializationFeatures

        public final boolean hasSerializationFeatures(int featureMask)
        "Bulk" access method for checking that all features specified by mask are enabled.
        Since:
        2.3
      • getSerializationFeatures

        public final int getSerializationFeatures()
      • getFilterProvider

        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)
      • getDefaultPrettyPrinter

        public com.fasterxml.jackson.core.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.

        Since:
        2.6
      • introspect

        public BeanDescription introspect(JavaType type)
        Method that will introspect full bean properties for the purpose of building a bean serializer

Copyright © 2008–2024 FasterXML. All rights reserved.