- All Implemented Interfaces:
Serializable,Comparable<DateTimeFeature>,Constable,JacksonFeature,DatatypeFeature
java.time) type handling (see
JavaTimeInitializer)
but also to "legacy" (Date, Calendar)
and Joda Date/Time.-
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 specifies whether context providedTimeZone(DeserializationContext.getTimeZone()should be used to adjust Date/Time values on deserialization, even if value itself contains timezone information.Feature that controls whether stringified numbers (Strings that without quotes would be legal JSON Numbers) may be interpreted as timestamps (enabled) or not (disabled), in case where there is an explicitly defined pattern (DateTimeFormatter, usually by using@JsonFormatannotation) for value.Feature that determines whetherZoneIdis normalized (via call tojava.time.ZoneId#normalized()) when deserializing types likeZonedDateTime.Feature that determines whetherMonthis serialized as and deserialized expected a zero- (false) or one-based index (true).Feature that controls whether numeric timestamp values are expected to be written using nanosecond timestamps (enabled) or not (disabled), if and only if datatype supports such resolution.Feature that determines whether theTimeZoneof theDeserializationContextis used when leniently deserializingLocalDateorLocalDateTimefrom the UTC/ISO instant format.Feature that controls whether numeric timestamp values are to be written using nanosecond timestamps (enabled) or not (disabled); if and only if datatype supports such resolution.Feature that determines whether Date (and date/time) values (and Date-based things likeCalendars) are to be serialized as numeric time stamps (true; the default), or as something else (usually textual representation).Feature that determines whether timezone/offset included in zoned date/time values (note: does NOTDatewill be overridden if there is an explicitly set context time zone.Feature that determines whether date/date-time values should be serialized so that they include timezone id, in cases where type itself contains timezone information.Feature that determines whether time values that represents time periods (durations, periods, ranges) are to be serialized by default using a numeric (true) or textual (false) representations. -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanenabledIn(int flags) intInternal index used for efficient storage and index; no user serviceable contents inside!intgetMask()static DateTimeFeatureReturns the enum constant of this class with the specified name.static DateTimeFeature[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ADJUST_DATES_TO_CONTEXT_TIME_ZONE
Feature that specifies whether context providedTimeZone(DeserializationContext.getTimeZone()should be used to adjust Date/Time values on deserialization, even if value itself contains timezone information. If enabled, contextualTimeZonewill essentially override any other TimeZone information; if disabled, it will only be used if value itself does not contain any TimeZone information.Note that exact behavior depends on date/time types in question; and specifically JDK type of
Datedoes NOT have in-built timezone information so this setting has no effect. Further, whileCalendardoes have this information basic JDKSimpleDateFormatis unable to retain parsed zone information, and as a result,Calendarwill always get context timezone adjustment regardless of this setting.Taking above into account, this feature is supported only by extension modules for Joda and Java 8 date/time datatypes.
Feature used to be one of
DeserializationFeatures in Jackson 2.x but was moved here in 3.0. -
ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS
Feature that controls whether stringified numbers (Strings that without quotes would be legal JSON Numbers) may be interpreted as timestamps (enabled) or not (disabled), in case where there is an explicitly defined pattern (DateTimeFormatter, usually by using@JsonFormatannotation) for value.Note that when the default pattern is used (no custom pattern defined), stringified numbers are always accepted as timestamps regardless of this feature.
-
NORMALIZE_DESERIALIZED_ZONE_ID
Feature that determines whetherZoneIdis normalized (via call tojava.time.ZoneId#normalized()) when deserializing types likeZonedDateTime.Default setting is enabled, for backwards-compatibility with Jackson 2.15.
-
ONE_BASED_MONTHS
Feature that determines whetherMonthis serialized as and deserialized expected a zero- (false) or one-based index (true). For example,Month.JANUARYwould be serialized as1when enabled but as0when disabled. Conversely JSON Number1would be deserialized asMonth.JANUARYwhen enabled, but asMonth.FEBRUARYwhen disabled.Default setting is
true, meaning that Month is serialized using one-based index and deserialized expecting one-based index.NOTE: default setting changed between Jackson 2.x (was
false) and Jackson 3.0 (changed totrue). -
READ_DATE_TIMESTAMPS_AS_NANOSECONDS
Feature that controls whether numeric timestamp values are expected to be written using nanosecond timestamps (enabled) or not (disabled), if and only if datatype supports such resolution. Only newer datatypes (such as Java8 Date/Time) support such resolution -- older types (pre-Java8 java.util.Date etc) and Joda do not -- and this setting has no effect on such types.If disabled, standard millisecond timestamps are assumed. This is the counterpart to
WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS.Feature used to be one of
DeserializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is enabled by default, to support most accurate time values possible (where available).
-
USE_TIME_ZONE_FOR_LENIENT_DATE_PARSING
Feature that determines whether theTimeZoneof theDeserializationContextis used when leniently deserializingLocalDateorLocalDateTimefrom the UTC/ISO instant format.Default setting is disabled, for backwards-compatibility with Jackson 2.18.
-
WRITE_DATES_AS_TIMESTAMPS
Feature that determines whether Date (and date/time) values (and Date-based things likeCalendars) are to be serialized as numeric time stamps (true; the default), or as something else (usually textual representation). If textual representation is used, the actual format depends on configuration settings including possible per-property use of@JsonFormatannotation, globally configuredDateFormat.For "classic" JDK date types (
Date,Calendar) the default formatting is provided byStdDateFormat, and corresponds to format String of "yyyy-MM-dd'T'HH:mm:ss.SSSX" (seeDateFormatfor details of format Strings). Whether this feature affects handling of other date-related types depend on handlers of those types, although ideally they should use this featureNote: whether
Mapkeys are serialized as Strings or not is controlled usingWRITE_DATE_KEYS_AS_TIMESTAMPSinstead of this feature.Feature used to be one of
SerializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is disabled by default as of Jackson 3.0 (in 2.x it was enabled), so that date/time are by default serialized as textual values NOT timestamps.
-
WRITE_DATE_KEYS_AS_TIMESTAMPS
Feature that determines whetherDates (and sub-types) used asMapkeys are serialized as time stamps or not (if not, will be serialized as textual values).Feature used to be one of
SerializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is disabled by default, meaning that Date-valued Map keys are serialized as textual (ISO-8601) values.
-
WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
Feature that controls whether numeric timestamp values are to be written using nanosecond timestamps (enabled) or not (disabled); if and only if datatype supports such resolution. Only newer datatypes (such as Java8 Date/Time) support such resolution -- older types (pre-Java8 java.util.Date etc) and Joda do not -- and this setting has no effect on such types.If disabled, standard millisecond timestamps are assumed. This is the counterpart to
READ_DATE_TIMESTAMPS_AS_NANOSECONDS.Feature used to be one of
SerializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is enabled by default, to support most accurate time values possible.
-
WRITE_DATES_WITH_CONTEXT_TIME_ZONE
Feature that determines whether timezone/offset included in zoned date/time values (note: does NOTDatewill be overridden if there is an explicitly set context time zone. If disabled, timezone/offset value is used-is; if enabled, context time zone is used instead.Note that this setting only affects "Zoned" date/time values of
Java 8 date/timetypes -- it will have no effect on oldjava.utilvalue handling (of whichDatehas no timezone information and must use contextual timezone, implicit or explicit; andCalendarwhich will always use timezone Calendar value has). Setting is also ignored by Joda date/time values.Feature used to be one of
SerializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is enabled by default for backwards-compatibility purposes (from Jackson 2.x)
-
WRITE_DATES_WITH_ZONE_ID
Feature that determines whether date/date-time values should be serialized so that they include timezone id, in cases where type itself contains timezone information. Including this information may lead to compatibility issues because ISO-8601 specification does not define formats that include such information.If enabled, Timezone id should be included using format specified with Java 8
DateTimeFormatter#ISO_ZONED_DATE_TIMEdefinition (for example, '2011-12-03T10:15:30+01:00[Europe/Paris]').Note: setting has no relevance if date/time values are serialized as timestamps.
Feature used to be one of
SerializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is disabled by default, so that zone id is NOT included; rather, timezone offset is used for ISO-8601 compatibility (if any timezone information is included in value).
-
WRITE_DURATIONS_AS_TIMESTAMPS
Feature that determines whether time values that represents time periods (durations, periods, ranges) are to be serialized by default using a numeric (true) or textual (false) representations. Note that numeric representation may mean either simple number, or an array of numbers, depending on type.Feature used to be one of
SerializationFeatures in Jackson 2.x but was moved here in 3.0.Feature is disabled by default as of Jackson 3.0 (in 2.x it was enabled), so that period/duration are by default serialized as textual values, NOT timestamps.
-
-
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
-