- All Implemented Interfaces:
Serializable,Comparable<EnumFeature>,Constable,JacksonFeature,DatatypeFeature
Enum types.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionFeature that determines whether JSON integer numbers are valid values to be used for deserializing Java enum values.Feature that determines standard deserialization mechanism used for Enum values: if enabled, Enums are assumed to have been serialized using index ofEnum;Feature that determines the deserialization mechanism used for Enum values: if enabled, Enums are assumed to have been serialized using return value ofEnum.toString(); if disabled, return value ofEnum.name()is assumed to have been used.Feature that allows unknown Enum values to be parsed asnullvalues.Feature that allows unknown Enum values to be ignored and replaced by a predefined value specified through@JsonEnumDefaultValueannotation.Feature that determines whether {link Enum}s used asMapkeys are serialized as usingEnum.ordinal()or not.Feature that determines standard serialization mechanism used for Enum values: if enabled, return value ofEnum.name().toLowerCase()is used; if disabled, return value ofEnum.name()is used.Feature that determines whether Java Enum values are serialized as numbers (true), or textual values (false).Feature that determines standard serialization mechanism used for Enum values: if enabled, return value ofEnum.toString()is used; if disabled, return value ofEnum.name()is used. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanenabledIn(int flags) intInternal index used for efficient storage and index; no user serviceable contents inside!intgetMask()static EnumFeatureReturns the enum constant of this class with the specified name.static EnumFeature[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
READ_ENUM_KEYS_USING_INDEX
Feature that determines standard deserialization mechanism used for Enum values: if enabled, Enums are assumed to have been serialized using index ofEnum;Note: this feature should be symmetric to as
WRITE_ENUM_KEYS_USING_INDEX.Feature is disabled by default.
- Since:
- 2.15
-
FAIL_ON_NUMBERS_FOR_ENUMS
Feature that determines whether JSON integer numbers are valid values to be used for deserializing Java enum values. If set to 'false' numbers are acceptable and are used to map to ordinal() of matching enumeration value; if 'true', numbers are not allowed and aDatabindExceptionwill be thrown. Latter behavior makes sense if there is concern that accidental mapping from integer values to enums might happen (and when enums are always serialized as JSON Strings)Feature used to be one of
DeserializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is disabled by default.
-
READ_ENUMS_USING_TO_STRING
Feature that determines the deserialization mechanism used for Enum values: if enabled, Enums are assumed to have been serialized using return value ofEnum.toString(); if disabled, return value ofEnum.name()is assumed to have been used.Note: this feature should usually have same value as
WRITE_ENUMS_USING_TO_STRING.Feature used to be one of
DeserializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is enabled by default as of Jackson 3.0 (in 2.x it was disabled).
-
READ_UNKNOWN_ENUM_VALUES_AS_NULL
Feature that allows unknown Enum values to be parsed asnullvalues. If disabled, unknown Enum values will throw exceptions.Note that in some cases this will effectively ignore unknown
Enumvalues, e.g. when the unknown values are used as keys ofEnumMapor values ofEnumSet: this is because these data structures cannot storenullvalues.Also note that this feature has lower precedence than
READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, meaning this feature will work only if latter feature is disabled.Feature used to be one of
DeserializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is disabled by default.
-
READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE
Feature that allows unknown Enum values to be ignored and replaced by a predefined value specified through@JsonEnumDefaultValueannotation. If disabled, unknown Enum values will throw exceptions. If enabled, but no predefined default Enum value is specified, an exception will be thrown as well.Note that this feature has higher precedence than
READ_UNKNOWN_ENUM_VALUES_AS_NULL.Feature used to be one of
DeserializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is disabled by default.
-
WRITE_ENUMS_TO_LOWERCASE
Feature that determines standard serialization mechanism used for Enum values: if enabled, return value ofEnum.name().toLowerCase()is used; if disabled, return value ofEnum.name()is used.NOTE: this feature CANNOT be changed on per-call basis: it will have to be set on
ObjectMapperbefore useFeature is disabled by default.
- Since:
- 2.15
-
WRITE_ENUMS_USING_TO_STRING
Feature that determines standard serialization mechanism used for Enum values: if enabled, return value ofEnum.toString()is used; if disabled, return value ofEnum.name()is used.Note: this feature should usually have same value as
READ_ENUMS_USING_TO_STRING.Feature used to be one of
SerializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is enabled by default as of Jackson 3.0 (in 2.x it was disabled).
-
WRITE_ENUMS_USING_INDEX
Feature that determines whether Java Enum values are serialized as numbers (true), or textual values (false). If textual values are used, other settings are also considered. If this feature is enabled, return value ofEnum.ordinal()(an integer) will be used as the serialization.Note that this feature has precedence over
WRITE_ENUMS_USING_TO_STRING, which is only considered if this feature is set to false.Note that since 2.10, this does NOT apply to
Enums written as keys ofMapvalues, which has separate setting,WRITE_ENUM_KEYS_USING_INDEX.Feature used to be one of
SerializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is disabled by default.
-
WRITE_ENUM_KEYS_USING_INDEX
Feature that determines whether {link Enum}s used asMapkeys are serialized as usingEnum.ordinal()or not. Similar toWRITE_ENUMS_USING_INDEXused when writingEnums as regular values.NOTE: counterpart for this settings is
READ_ENUM_KEYS_USING_INDEX.Feature used to be one of
SerializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is disabled by default.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
enabledByDefault
public boolean enabledByDefault()- Specified by:
enabledByDefaultin interfaceJacksonFeature
-
enabledIn
public boolean enabledIn(int flags) - Specified by:
enabledInin interfaceJacksonFeature
-
getMask
public int getMask()- Specified by:
getMaskin interfaceJacksonFeature
-
featureIndex
public int featureIndex()Description copied from interface:DatatypeFeatureInternal index used for efficient storage and index; no user serviceable contents inside!- Specified by:
featureIndexin interfaceDatatypeFeature
-