org.codehaus.jackson.map
Enum SerializationConfig.Feature

java.lang.Object
  extended by java.lang.Enum<SerializationConfig.Feature>
      extended by org.codehaus.jackson.map.SerializationConfig.Feature
All Implemented Interfaces:
Serializable, Comparable<SerializationConfig.Feature>
Enclosing class:
SerializationConfig

public static enum SerializationConfig.Feature
extends Enum<SerializationConfig.Feature>

Enumeration that defines togglable features that guide the serialization feature.


Enum Constant Summary
AUTO_DETECT_FIELDS
          Feature that determines whether non-static fields are recognized as properties.
AUTO_DETECT_GETTERS
          Feature that determines whether regualr "getter" methods are automatically detected based on standard Bean naming convention or not.
AUTO_DETECT_IS_GETTERS
          Feature that determines whether "is getter" methods are automatically detected based on standard Bean naming convention or not.
CAN_OVERRIDE_ACCESS_MODIFIERS
          Feature that determines whether method and field access modifier settings can be overridden when accessing properties.
DEFAULT_VIEW_INCLUSION
          Feature that determines whether properties that have no view annotations are included in JSON serialization views (see JsonView for more details on JSON Views).
FAIL_ON_EMPTY_BEANS
          Feature that determines what happens when no accessors are found for a type (and there are no annotations to indicate it is meant to be serialized).
INDENT_OUTPUT
          Feature that allows enabling (or disabling) indentation for the underlying generator, using the default pretty printer (see JsonGenerator.useDefaultPrettyPrinter() for details).
USE_ANNOTATIONS
          Feature that determines whether annotation introspection is used for configuration; if enabled, configured AnnotationIntrospector will be used: if disabled, no annotations are considered.
USE_STATIC_TYPING
          Feature that determines whether the type detection for serialization should be using actual dynamic runtime type, or declared static type.
WRAP_ROOT_VALUE
          Feature that can be enabled to make root value (usually JSON Object but can be any type) wrapped within a single property JSON object, where key as the "root name", as determined by annotation introspector (esp.
WRITE_DATES_AS_TIMESTAMPS
          Feature that determines whether Dates (and Date-based things like Calendars) are to be serialized as numeric timestamps (true; the default), or as something else (usually textual representation).
WRITE_NULL_PROPERTIES
          Deprecated. As of 1.1, use SerializationConfig.setSerializationInclusion(org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion) instead
 
Method Summary
static int collectDefaults()
          Method that calculates bit set (flags) of all features that are enabled by default.
 boolean enabledByDefault()
           
 int getMask()
           
static SerializationConfig.Feature valueOf(String name)
          Returns the enum constant of this type with the specified name.
static SerializationConfig.Feature[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

USE_ANNOTATIONS

public static final SerializationConfig.Feature USE_ANNOTATIONS
Feature that determines whether annotation introspection is used for configuration; if enabled, configured AnnotationIntrospector will be used: if disabled, no annotations are considered.

Feature is enabled by default.

Since:
1.2

AUTO_DETECT_GETTERS

public static final SerializationConfig.Feature AUTO_DETECT_GETTERS
Feature that determines whether regualr "getter" methods are automatically detected based on standard Bean naming convention or not. If yes, then all public zero-argument methods that start with prefix "get" are considered as getters. If disabled, only methods explicitly annotated are considered getters.

Note that since version 1.3, this does NOT include "is getters" (see AUTO_DETECT_IS_GETTERS for details)

Note that this feature has lower precedence than per-class annotations, and is only used if there isn't more granular configuration available.

Feature is enabled by default.


AUTO_DETECT_IS_GETTERS

public static final SerializationConfig.Feature AUTO_DETECT_IS_GETTERS
Feature that determines whether "is getter" methods are automatically detected based on standard Bean naming convention or not. If yes, then all public zero-argument methods that start with prefix "is", and whose return type is boolean are considered as "is getters". If disabled, only methods explicitly annotated are considered getters.

Note that this feature has lower precedence than per-class annotations, and is only used if there isn't more granular configuration available.

Feature is enabled by default.


AUTO_DETECT_FIELDS

public static final SerializationConfig.Feature AUTO_DETECT_FIELDS
Feature that determines whether non-static fields are recognized as properties. If yes, then all public member fields are considered as properties. If disabled, only fields explicitly annotated are considered property fields.

Note that this feature has lower precedence than per-class annotations, and is only used if there isn't more granular configuration available.

Feature is enabled by default.

Since:
1.1

CAN_OVERRIDE_ACCESS_MODIFIERS

public static final SerializationConfig.Feature CAN_OVERRIDE_ACCESS_MODIFIERS
Feature that determines whether method and field access modifier settings can be overridden when accessing properties. If enabled, method AccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean) may be called to enable access to otherwise unaccessible objects.


WRITE_NULL_PROPERTIES

public static final SerializationConfig.Feature WRITE_NULL_PROPERTIES
Deprecated. As of 1.1, use SerializationConfig.setSerializationInclusion(org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion) instead
Feature that determines the default settings of whether Bean properties with null values are to be written out.

Feature is enabled by default (null properties written).

Note too that there is annotation JsonWriteNullProperties that can be used for more granular control (annotates bean classes or individual property access methods).


USE_STATIC_TYPING

public static final SerializationConfig.Feature USE_STATIC_TYPING
Feature that determines whether the type detection for serialization should be using actual dynamic runtime type, or declared static type. Default value is false, to use dynamic runtime type.

This global default value can be overridden at class, method or field level by using JsonSerialize.typing() annotation property


WRAP_ROOT_VALUE

public static final SerializationConfig.Feature WRAP_ROOT_VALUE
Feature that can be enabled to make root value (usually JSON Object but can be any type) wrapped within a single property JSON object, where key as the "root name", as determined by annotation introspector (esp. for JAXB that uses @XmlRootElement.name) or fallback (non-qualified class name). Feature is mostly intended for JAXB compatibility.

Default setting is false, meaning root value is not wrapped.

NOTE: Support for this feature has NOT been implemented -- it is reserved for future expansion.

Since:
1.3

FAIL_ON_EMPTY_BEANS

public static final SerializationConfig.Feature FAIL_ON_EMPTY_BEANS
Feature that determines what happens when no accessors are found for a type (and there are no annotations to indicate it is meant to be serialized). If enabled (default), an exception is thrown to indicate these as non-serializable types; if disabled, they are serialized as empty Objects, i.e. without any properties.

Note that empty types that this feature has only effect on those "empty" beans that do not have any recognized annotations (like @JsonSerialize): ones that do have annotations do not result in an exception being thrown.

Since:
1.4

DEFAULT_VIEW_INCLUSION

public static final SerializationConfig.Feature DEFAULT_VIEW_INCLUSION
Feature that determines whether properties that have no view annotations are included in JSON serialization views (see JsonView for more details on JSON Views). If enabled, non-annotated properties will be included; when disabled, they will be excluded. So this feature changes between "opt-in" (feature disabled) and "opt-out" (feature enabled) modes.

Default value is enabled, meaning that non-annotated properties are included in all views if there is no JsonView annotation.

Since:
1.5

WRITE_DATES_AS_TIMESTAMPS

public static final SerializationConfig.Feature WRITE_DATES_AS_TIMESTAMPS
Feature that determines whether Dates (and Date-based things like Calendars) are to be serialized as numeric timestamps (true; the default), or as something else (usually textual representation). If textual representation is used, the actual format is one returned by a call to SerializationConfig.getDateFormat().

Note: whether this feature affects handling of other date-related types depend on handlers of those types.


INDENT_OUTPUT

public static final SerializationConfig.Feature INDENT_OUTPUT
Feature that allows enabling (or disabling) indentation for the underlying generator, using the default pretty printer (see JsonGenerator.useDefaultPrettyPrinter() for details).

Note that this only affects cases where JsonGenerator is constructed implicitly by ObjectMapper: if explicit generator is passed, its configuration is not changed.

Also note that if you want to configure details of indentation, you need to directly configure the generator: there is a method to use any PrettyPrinter instance. This feature will only allow using the default implementation.

Method Detail

values

public static SerializationConfig.Feature[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SerializationConfig.Feature c : SerializationConfig.Feature.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static SerializationConfig.Feature valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

collectDefaults

public static int collectDefaults()
Method that calculates bit set (flags) of all features that are enabled by default.


enabledByDefault

public boolean enabledByDefault()

getMask

public int getMask()