Package com.fasterxml.jackson.annotation
Enum JsonFormat.Feature
- java.lang.Object
-
- java.lang.Enum<JsonFormat.Feature>
-
- com.fasterxml.jackson.annotation.JsonFormat.Feature
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<JsonFormat.Feature>
- Enclosing class:
- JsonFormat
public static enum JsonFormat.Feature extends java.lang.Enum<JsonFormat.Feature>
Set of features that can be enabled/disabled for property annotated. These often relate to specificSerializationFeatureorDeserializationFeature, as noted by entries.Note that whether specific setting has an effect depends on whether
JsonSerializer/JsonDeserializerbeing used takes the format setting into account. If not, please file an issue for adding support via issue tracker for package that has handlers (if you know which one; if not, just use `jackson-databind`).- Since:
- 2.6
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ACCEPT_CASE_INSENSITIVE_PROPERTIESOverride forMapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, which allows case-insensitive matching of property names (but NOT values, seeACCEPT_CASE_INSENSITIVE_VALUESfor that).ACCEPT_CASE_INSENSITIVE_VALUESOverride forMapperFeature.ACCEPT_CASE_INSENSITIVE_VALUES, which allows case-sensitive matching of (some) property values, such asEnums.ACCEPT_SINGLE_VALUE_AS_ARRAYOverride forDeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAYwhich will allow deserialization of JSON non-array values into single-element Java arrays andCollections.ADJUST_DATES_TO_CONTEXT_TIME_ZONEOverride forDeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIMEZONEthat specifies whether context provided timezoneDeserializationContext.getTimeZone()should be used to adjust Date/Time values on deserialization, even if value itself contains timezone informationREAD_DATE_TIMESTAMPS_AS_NANOSECONDSOverride forDeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, (counterpart toWRITE_DATE_TIMESTAMPS_AS_NANOSECONDS), similar constraints apply.READ_UNKNOWN_ENUM_VALUES_AS_NULLOverride forDeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, which allows unknown Enum values to be parsed as null values.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUEOverride forDeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, which allows unknown Enum values to be ignored and a predefined value specified through@JsonEnumDefaultValueannotation.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDSOverride forSerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, similar constraints apply.WRITE_DATES_WITH_ZONE_IDOverride forSerializationFeature.WRITE_DATES_WITH_ZONE_ID, similar constraints apply.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPEDOverride forSerializationFeature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPEDwhich will force serialization of single-element arrays andCollections as that single element and excluding array wrapper.WRITE_SORTED_MAP_ENTRIESOverride forSerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, enabling of which will force sorting ofMapkeys before serialization.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static JsonFormat.FeaturevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static JsonFormat.Feature[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
ACCEPT_SINGLE_VALUE_AS_ARRAY
public static final JsonFormat.Feature ACCEPT_SINGLE_VALUE_AS_ARRAY
Override forDeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAYwhich will allow deserialization of JSON non-array values into single-element Java arrays andCollections.
-
ACCEPT_CASE_INSENSITIVE_PROPERTIES
public static final JsonFormat.Feature ACCEPT_CASE_INSENSITIVE_PROPERTIES
Override forMapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, which allows case-insensitive matching of property names (but NOT values, seeACCEPT_CASE_INSENSITIVE_VALUESfor that).Only affects deserialization, has no effect on serialization.
- Since:
- 2.8
-
READ_UNKNOWN_ENUM_VALUES_AS_NULL
public static final JsonFormat.Feature READ_UNKNOWN_ENUM_VALUES_AS_NULL
Override forDeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, which allows unknown Enum values to be parsed as null values.- Since:
- 2.15
-
READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE
public static final JsonFormat.Feature READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE
Override forDeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, which allows unknown Enum values to be ignored and a predefined value specified through@JsonEnumDefaultValueannotation.- Since:
- 2.15
-
READ_DATE_TIMESTAMPS_AS_NANOSECONDS
public static final JsonFormat.Feature READ_DATE_TIMESTAMPS_AS_NANOSECONDS
Override forDeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, (counterpart toWRITE_DATE_TIMESTAMPS_AS_NANOSECONDS), similar constraints apply.- Since:
- 2.15
-
ACCEPT_CASE_INSENSITIVE_VALUES
public static final JsonFormat.Feature ACCEPT_CASE_INSENSITIVE_VALUES
Override forMapperFeature.ACCEPT_CASE_INSENSITIVE_VALUES, which allows case-sensitive matching of (some) property values, such asEnums. Only affects deserialization, has no effect on serialization.- Since:
- 2.10
-
WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
public static final JsonFormat.Feature WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
Override forSerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, similar constraints apply.
-
WRITE_DATES_WITH_ZONE_ID
public static final JsonFormat.Feature WRITE_DATES_WITH_ZONE_ID
Override forSerializationFeature.WRITE_DATES_WITH_ZONE_ID, similar constraints apply.
-
WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED
public static final JsonFormat.Feature WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED
Override forSerializationFeature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPEDwhich will force serialization of single-element arrays andCollections as that single element and excluding array wrapper.
-
WRITE_SORTED_MAP_ENTRIES
public static final JsonFormat.Feature WRITE_SORTED_MAP_ENTRIES
Override forSerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, enabling of which will force sorting ofMapkeys before serialization.
-
ADJUST_DATES_TO_CONTEXT_TIME_ZONE
public static final JsonFormat.Feature ADJUST_DATES_TO_CONTEXT_TIME_ZONE
Override forDeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIMEZONEthat specifies whether context provided timezoneDeserializationContext.getTimeZone()should be used to adjust Date/Time values on deserialization, even if value itself contains timezone informationNOTE: due to limitations of "old" JDK date/time types (that is,
DateandCalendar), this setting is only applicable toJodaandJava 8 date/timevalues, but not tojava.util.Dateorjava.util.Calendar.- Since:
- 2.8
-
-
Method Detail
-
values
public static JsonFormat.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 (JsonFormat.Feature c : JsonFormat.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 JsonFormat.Feature valueOf(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
-