|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<DeserializationFeature> com.fasterxml.jackson.databind.DeserializationFeature
public enum DeserializationFeature
Enumeration that defines simple on/off features that affect the way Java objects are deserialized from JSON
Note that features can be set both through
ObjectMapper
(as sort of defaults) and through
ObjectReader
.
In first case these defaults must follow "config-then-use" patterns
(i.e. defined once, not changed afterwards); all per-call
changes must be done using ObjectReader
.
Enum Constant Summary | |
---|---|
ACCEPT_EMPTY_STRING_AS_NULL_OBJECT
Feature that can be enabled to allow JSON empty String value ("") to be bound to POJOs as null. |
|
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. |
|
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'). |
|
FAIL_ON_NUMBERS_FOR_ENUMS
Feature that determines whether JSON integer numbers are valid values to be used for deserializing Java enum values. |
|
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 a JsonMappingException ) or not. |
|
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 of Enum.toString() ;
if disabled, return value of Enum.name() is assumed to have been used. |
|
READ_UNKNOWN_ENUM_VALUES_AS_NULL
Feature that allows unknown Enum values to be parsed as null values. |
|
UNWRAP_ROOT_VALUE
Feature to allow "unwrapping" root-level JSON value, to match setting of SerializationFeature.WRAP_ROOT_VALUE used for serialization. |
|
USE_BIG_DECIMAL_FOR_FLOATS
Feature that determines whether JSON floating point numbers are to be deserialized into BigDecimal s
if only generic type description (either Object or
Number , or within untyped Map
or Collection context) is available. |
|
USE_BIG_INTEGER_FOR_INTS
Feature that determines whether JSON integral (non-floating-point) numbers are to be deserialized into BigInteger s
if only generic type description (either Object or
Number , or within untyped Map
or Collection context) is available. |
|
USE_JAVA_ARRAY_FOR_JSON_ARRAY
Feature that determines whether JSON Array is mapped to Object[] or List<Object> when binding
"untyped" objects (ones with nominal type of java.lang.Object ). |
|
WRAP_EXCEPTIONS
Feature that determines whether Jackson code should catch and wrap Exception s (but never Error s!)
to add additional information about
location (within input) of problem or not. |
Method Summary | |
---|---|
boolean |
enabledByDefault()
Accessor for checking whether this feature is enabled by default. |
int |
getMask()
Returns bit mask for this feature instance |
static DeserializationFeature |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static DeserializationFeature[] |
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 |
---|
public static final DeserializationFeature USE_BIG_DECIMAL_FOR_FLOATS
BigDecimal
s
if only generic type description (either Object
or
Number
, or within untyped Map
or Collection
context) is available.
If enabled such values will be deserialized as BigDecimal
s;
if disabled, will be deserialized as Double
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).
public static final DeserializationFeature USE_BIG_INTEGER_FOR_INTS
BigInteger
s
if only generic type description (either Object
or
Number
, or within untyped Map
or Collection
context) is available.
If enabled such values will be deserialized as
BigInteger
s;
if disabled, will be deserialized as "smallest" available type,
which is either Integer
, Long
or
BigInteger
, 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.
public static final DeserializationFeature USE_JAVA_ARRAY_FOR_JSON_ARRAY
Object[]
or List<Object>
when binding
"untyped" objects (ones with nominal type of java.lang.Object
).
If true, binds as Object[]
; if false, as List<Object>
.
Feature is disabled by default, meaning that JSON arrays are bound as
List
s.
public static final DeserializationFeature READ_ENUMS_USING_TO_STRING
Enum.toString()
;
if disabled, return value of Enum.name()
is assumed to have been used.
Note: this feature should usually have same value
as SerializationFeature.WRITE_ENUMS_USING_TO_STRING
.
Feature is disabled by default.
public static final DeserializationFeature FAIL_ON_UNKNOWN_PROPERTIES
JsonMappingException
) 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 a
JsonMappingException
will be thrown if an unknown property
is encountered).
public static final DeserializationFeature FAIL_ON_NULL_FOR_PRIMITIVES
Feature is disabled by default.
public static final DeserializationFeature FAIL_ON_NUMBERS_FOR_ENUMS
JsonMappingException
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.
public static final DeserializationFeature WRAP_EXCEPTIONS
Exception
s (but never Error
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 that IOException
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.
public static final DeserializationFeature ACCEPT_SINGLE_VALUE_AS_ARRAY
Feature is disabled by default.
public static final DeserializationFeature UNWRAP_ROOT_VALUE
SerializationFeature.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, a
JsonMappingException
is thrown; otherwise value of the wrapped property
will be deserialized as if it was the root value.
Feature is disabled by default.
public static final DeserializationFeature ACCEPT_EMPTY_STRING_AS_NULL_OBJECT
Feature is enabled by default.
public static final DeserializationFeature READ_UNKNOWN_ENUM_VALUES_AS_NULL
Note that in some cases this will basically ignore unknown Enum values;
this is the keys for keys of EnumMap
and values
of EnumSet
(because nulls are not accepted in these
cases).
Feature is disabled by default.
Method Detail |
---|
public static DeserializationFeature[] values()
for (DeserializationFeature c : DeserializationFeature.values()) System.out.println(c);
public static DeserializationFeature valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic boolean enabledByDefault()
ConfigFeature
enabledByDefault
in interface ConfigFeature
public int getMask()
ConfigFeature
getMask
in interface ConfigFeature
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |