Enum Class CalendarFormat
- All Implemented Interfaces:
Serializable,Comparable<CalendarFormat>,Constable
Calendar values.
Used by MarshallingContext.Builder.calendarFormat(CalendarFormat),
Marshalled.calendarFormat(),
MarshalledProp.calendarFormat(), and
MarshalledConfig.calendarFormat() to control how
Calendar values (including GregorianCalendar) are written to and read from the wire.
The default is ISO_OFFSET_DATE_TIME which preserves the historical wire output produced
before this enum existed.
Numeric formats (MILLIS) emit native numeric wire types on binary serializers
(BSON / CBOR / MsgPack) and bare numbers on text formats. Text formats emit a quoted ISO 8601 string for
every other constant.
XMLGregorianCalendar fields always emit toXMLFormat() regardless of the configured
CalendarFormat. The XML_FORMAT constant exists so that regular Calendar /
GregorianCalendar fields can opt into the same wire form for symmetry with their
XMLGregorianCalendar siblings.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDateTimeFormatter.BASIC_ISO_DATE:"20111203" .DateTimeFormatter.ISO_DATE_TIME:"2011-12-03T10:15:30+01:00[Europe/Paris]" .DateTimeFormatter.ISO_INSTANT:"2011-12-03T10:15:30Z" .DateTimeFormatter.ISO_LOCAL_DATE:"2011-12-03" .DateTimeFormatter.ISO_LOCAL_DATE_TIME:"2011-12-03T10:15:30" .DateTimeFormatter.ISO_LOCAL_TIME:"10:15:30" .DateTimeFormatter.ISO_OFFSET_DATE:"2011-12-03+01:00" .DateTimeFormatter.ISO_OFFSET_DATE_TIME(the default):"2011-12-03T10:15:30+01:00" .DateTimeFormatter.ISO_OFFSET_TIME:"10:15:30+01:00" .DateTimeFormatter.ISO_ORDINAL_DATE:"2012-337" .DateTimeFormatter.ISO_WEEK_DATE:"2012-W48-6" .DateTimeFormatter.ISO_ZONED_DATE_TIME:"2011-12-03T10:15:30+01:00[Europe/Paris]" .Epoch milliseconds as a numeric value.Sentinel meaning "no value configured" — falls through to the next-higher precedence level.DateTimeFormatter.RFC_1123_DATE_TIME:"Tue, 3 Jun 2008 11:05:30 GMT" .XML Schema dateTimeform. -
Method Summary
Modifier and TypeMethodDescriptionFormats the specified value using this format.booleanReturnstrue if this format is numeric on the wire.Parses the specified wire value using this format.static CalendarFormatReturns the enum constant of this class with the specified name.static CalendarFormat[]values()Returns an array containing the constants of this enum class, in the order they are declared.static ZoneIdzuluZone()Returns theZoneIdused by theISO_INSTANTvariant.
-
Enum Constant Details
-
NOT_SET
Sentinel meaning "no value configured" — falls through to the next-higher precedence level. -
BASIC_ISO_DATE
DateTimeFormatter.BASIC_ISO_DATE:"20111203" . -
ISO_DATE
-
ISO_DATE_TIME
DateTimeFormatter.ISO_DATE_TIME:"2011-12-03T10:15:30+01:00[Europe/Paris]" . -
ISO_INSTANT
DateTimeFormatter.ISO_INSTANT:"2011-12-03T10:15:30Z" . -
ISO_LOCAL_DATE
DateTimeFormatter.ISO_LOCAL_DATE:"2011-12-03" . -
ISO_LOCAL_DATE_TIME
DateTimeFormatter.ISO_LOCAL_DATE_TIME:"2011-12-03T10:15:30" . -
ISO_LOCAL_TIME
DateTimeFormatter.ISO_LOCAL_TIME:"10:15:30" . -
ISO_OFFSET_DATE
DateTimeFormatter.ISO_OFFSET_DATE:"2011-12-03+01:00" . -
ISO_OFFSET_DATE_TIME
DateTimeFormatter.ISO_OFFSET_DATE_TIME(the default):"2011-12-03T10:15:30+01:00" . -
ISO_OFFSET_TIME
DateTimeFormatter.ISO_OFFSET_TIME:"10:15:30+01:00" . -
ISO_ORDINAL_DATE
DateTimeFormatter.ISO_ORDINAL_DATE:"2012-337" . -
ISO_TIME
-
ISO_WEEK_DATE
DateTimeFormatter.ISO_WEEK_DATE:"2012-W48-6" . -
ISO_ZONED_DATE_TIME
DateTimeFormatter.ISO_ZONED_DATE_TIME:"2011-12-03T10:15:30+01:00[Europe/Paris]" . -
RFC_1123_DATE_TIME
DateTimeFormatter.RFC_1123_DATE_TIME:"Tue, 3 Jun 2008 11:05:30 GMT" . -
MILLIS
Epoch milliseconds as a numeric value.Emitted as a native int64 by binary serializers (BSON / CBOR / MsgPack) and as a bare integer literal by text serializers.
-
XML_FORMAT
XML Schema dateTimeform.Lets regular
Calendar/GregorianCalendarfields opt into the same wire form thatXMLGregorianCalendarfields always use, for symmetry across mixed-type beans.
-
-
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
-
format
Formats the specified value using this format.- Parameters:
value- The value to format. Can benull (returnsnull ).zoneId- The default zone id used for time-only / unzoned values.- Returns:
- The formatted string, or
null ifvalueisnull .
-
parse
Parses the specified wire value using this format.- Parameters:
value- The wire value. Can benull or blank (returnsnull ).zoneId- The default zone id used for time-only / unzoned values.- Returns:
- The parsed
Calendar, ornull ifvalueisnull or blank.
-
isNumeric
Returnstrue if this format is numeric on the wire.- Returns:
true if this format emits a numeric wire value.
-
zuluZone
Returns theZoneIdused by theISO_INSTANTvariant.- Returns:
- The fixed
"Z"(UTC) zone id used by theISO_INSTANTvariant.
-