Enum Class DeserializationConfig.Feature
- All Implemented Interfaces:
Serializable
,Comparable<DeserializationConfig.Feature>
,Constable
,MapperConfig.ConfigFeature
- Enclosing class:
- DeserializationConfig
-
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 can be enabled to allow JSON empty String value ("") to be bound to POJOs as null.Feature that determines whether it is acceptable to coerce non-array (in JSON) values to work with Java collection (arrays, java.util.Collection) types.Feature that determines whether "creator" methods are automatically detected by consider public constructors, and static single argument methods with name "valueOf".Feature that determines whether non-static fields are recognized as properties.Feature that determines whether "setter" methods are automatically detected based on standard Bean naming convention or not.Feature that determines whether method and field access modifier settings can be overridden when accessing properties.Feature that determines whether encountering of JSON null is an error when deserializing into Java primitive types (like 'int' or 'double').Feature that determines whether JSON integer numbers are valid values to be used for deserializing Java enum values.Feature that determines whether encountering of unknown properties (ones that do not map to a property, and there is no "any setter" or handler that can handle it) should result in a failure (by throwing aJsonMappingException
) or not.Feature that determines standard 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 to allow "unwrapping" root-level JSON value, to match setting ofSerializationConfig.Feature.WRAP_ROOT_VALUE
used for serialization.Feature that determines whether annotation introspection is used for configuration; if enabled, configuredAnnotationIntrospector
will be used: if disabled, no annotations are considered.Feature that determines whether Json floating point numbers are to be deserialized intoBigDecimal
s if only generic type description (eitherObject
orNumber
, or within untypedMap
orCollection
context) is available.Feature that determines whether Json integral (non-floating-point) numbers are to be deserialized intoBigInteger
s if only generic type description (eitherObject
orNumber
, or within untypedMap
orCollection
context) is available.Feature that determines whether otherwise regular "getter" methods (but only ones that handle Collections and Maps, not getters of other type) can be used for purpose of getting a reference to a Collection and Map to modify the property, without requiring a setter method.Feature that determines whether JSON Array is mapped toObject[]
orList<Object>
when binding "untyped" objects (ones with nominal type ofjava.lang.Object
). -
Method Summary
Modifier and TypeMethodDescriptionboolean
Accessor for checking whether this feature is enabled by default.int
getMask()
Returns bit mask for this feature instanceReturns the enum constant of this class with the specified name.static DeserializationConfig.Feature[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
USE_ANNOTATIONS
Feature that determines whether annotation introspection is used for configuration; if enabled, configuredAnnotationIntrospector
will be used: if disabled, no annotations are considered.Feature is enabled by default.
- Since:
- 1.2
-
AUTO_DETECT_SETTERS
Feature that determines whether "setter" methods are automatically detected based on standard Bean naming convention or not. If yes, then all public one-argument methods that start with prefix "set" are considered setters. If disabled, only methods explicitly annotated are considered setters.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_CREATORS
Feature that determines whether "creator" methods are automatically detected by consider public constructors, and static single argument methods with name "valueOf". If disabled, only methods explicitly annotated are considered creator methods (except for the no-arg default constructor which is always considered a factory method).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
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
-
USE_GETTERS_AS_SETTERS
Feature that determines whether otherwise regular "getter" methods (but only ones that handle Collections and Maps, not getters of other type) can be used for purpose of getting a reference to a Collection and Map to modify the property, without requiring a setter method. This is similar to how JAXB framework sets Collections and Maps: no setter is involved, just setter.Note that such getters-as-setters methods have lower precedence than setters, so they are only used if no setter is found for the Map/Collection property.
Feature is enabled by default.
-
CAN_OVERRIDE_ACCESS_MODIFIERS
Feature that determines whether method and field access modifier settings can be overridden when accessing properties. If enabled, methodAccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean)
may be called to enable access to otherwise unaccessible objects. -
USE_BIG_DECIMAL_FOR_FLOATS
Feature that determines whether Json floating point numbers are to be deserialized intoBigDecimal
s if only generic type description (eitherObject
orNumber
, or within untypedMap
orCollection
context) is available. If enabled such values will be deserialized asBigDecimal
s; if disabled, will be deserialized asDouble
s.Feature is disabled by default, meaning that "untyped" floating point numbers will by default be deserialized as
Double
s (choice is for performance reason -- BigDecimals are slower than Doubles) -
USE_BIG_INTEGER_FOR_INTS
Feature that determines whether Json integral (non-floating-point) numbers are to be deserialized intoBigInteger
s if only generic type description (eitherObject
orNumber
, or within untypedMap
orCollection
context) is available. If enabled such values will be deserialized asBigInteger
s; if disabled, will be deserialized as "smallest" available type, which is eitherInteger
,Long
orBigInteger
, depending on number of digits.Feature is disabled by default, meaning that "untyped" floating point numbers will by default be deserialized using whatever is the most compact integral type, to optimize efficiency.
-
USE_JAVA_ARRAY_FOR_JSON_ARRAY
Feature that determines whether JSON Array is mapped toObject[]
orList<Object>
when binding "untyped" objects (ones with nominal type ofjava.lang.Object
). If true, binds asObject[]
; if false, asList<Object>
.Feature is disabled by default, meaning that JSON arrays are bound as
List
s.- Since:
- 1.9
-
READ_ENUMS_USING_TO_STRING
Feature that determines standard 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. Since pre-1.6 method was to use Enum name, this is the default.Note: this feature should usually have same value as
SerializationConfig.Feature.WRITE_ENUMS_USING_TO_STRING
.For further details, check out [JACKSON-212]
- Since:
- 1.6
-
FAIL_ON_UNKNOWN_PROPERTIES
Feature that determines whether encountering of unknown properties (ones that do not map to a property, and there is no "any setter" or handler that can handle it) should result in a failure (by throwing aJsonMappingException
) or not. This setting only takes effect after all other handling methods for unknown properties have been tried, and property remains unhandled.Feature is enabled by default, meaning that
JsonMappingException
is thrown if an unknown property is encountered. This is the implicit default prior to introduction of the feature.- Since:
- 1.2
-
FAIL_ON_NULL_FOR_PRIMITIVES
Feature that determines whether encountering of JSON null is an error when deserializing into Java primitive types (like 'int' or 'double'). If it is, a JsonProcessingException is thrown to indicate this; if not, default value is used (0 for 'int', 0.0 for double, same defaulting as what JVM uses).Feature is disabled by default (to be consistent with behavior of Jackson 1.6), i.e. to allow use of nulls for primitive properties.
- Since:
- 1.7
-
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 aJsonMappingException
will 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 is disabled by default (to be consistent with behavior of Jackson 1.6), i.e. to allow use of JSON integers for Java enums.
- Since:
- 1.7
-
WRAP_EXCEPTIONS
Feature that determines whether Jackson code should catch and wrapException
s (but neverError
s!) to add additional information about location (within input) of problem or not. If enabled, most exceptions will be caught and re-thrown (exception specifically being thatIOException
s may be passed as is, since they are declared as throwable); this can be convenient both in that all exceptions will be checked and declared, and so there is more contextual information. However, sometimes calling application may just want "raw" unchecked exceptions passed as is.Feature is enabled by default, and is similar in behavior to default prior to 1.7.
- Since:
- 1.7
-
ACCEPT_SINGLE_VALUE_AS_ARRAY
Feature that determines whether it is acceptable to coerce non-array (in JSON) values to work with Java collection (arrays, java.util.Collection) types. If enabled, collection deserializers will try to handle non-array values as if they had "implicit" surrounding JSON array. This feature is meant to be used for compatibility/interoperability reasons, to work with packages (such as XML-to-JSON converters) that leave out JSON array in cases where there is just a single element in array.- Since:
- 1.8
-
UNWRAP_ROOT_VALUE
Feature to allow "unwrapping" root-level JSON value, to match setting ofSerializationConfig.Feature.WRAP_ROOT_VALUE
used for serialization. Will verify that the root JSON value is a JSON Object, and that it has a single property with expected root name. If not, aJsonMappingException
is thrown; otherwise value of the wrapped property will be deserialized as if it was the root value.- Since:
- 1.9
-
ACCEPT_EMPTY_STRING_AS_NULL_OBJECT
Feature that can be enabled to allow JSON empty String value ("") to be bound to POJOs as null. If disabled, standard POJOs can only be bound from JSON null or JSON Object (standard meaning that no custom deserializers or constructors are defined; both of which can add support for other kinds of JSON values); if enable, empty JSON String can be taken to be equivalent of JSON null.- Since:
- 1.8
-
-
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()Description copied from interface:MapperConfig.ConfigFeature
Accessor for checking whether this feature is enabled by default.- Specified by:
enabledByDefault
in interfaceMapperConfig.ConfigFeature
-
getMask
public int getMask()Description copied from interface:MapperConfig.ConfigFeature
Returns bit mask for this feature instance- Specified by:
getMask
in interfaceMapperConfig.ConfigFeature
-