Enum Class TimeZoneFormat

java.lang.Object
java.lang.Enum<TimeZoneFormat>
org.apache.juneau.marshall.TimeZoneFormat
All Implemented Interfaces:
Serializable, Comparable<TimeZoneFormat>, Constable

public enum TimeZoneFormat extends Enum<TimeZoneFormat>
Supported wire formats for TimeZone and ZoneId values.

Used by MarshallingContext.Builder.timeZoneFormat(TimeZoneFormat), Marshalled.timeZoneFormat(), MarshalledProp.timeZoneFormat(), and MarshalledConfig.timeZoneFormat() to control how time-zone identifiers are written to and read from the wire.

The default is ID which preserves the historical wire output produced before this enum existed (TimeZone.getID() / ZoneId.getId()).

  • Enum Constant Details

    • NOT_SET

      public static final TimeZoneFormat NOT_SET
      Sentinel meaning "no value configured" — falls through to the next-higher precedence level.
    • ID

      public static final TimeZoneFormat ID
      The IANA zone id (the default): "America/Los_Angeles", "UTC", "GMT-08:00".
    • OFFSET

      public static final TimeZoneFormat OFFSET
      Normalized to a ZoneOffset where possible: "-08:00"; falls back to ID for region zones.
    • NAME_LONG

      public static final TimeZoneFormat NAME_LONG
      Default long display name in Locale.ROOT (formatting only; not always round-trippable): "Pacific Standard Time".

      Parsing accepts any value that ZoneId.of(String) understands; localized display names are not reverse-parsed.

    • NAME_SHORT

      public static final TimeZoneFormat NAME_SHORT
      Default short display name in Locale.ROOT (formatting only; not always round-trippable): "PST".

      Parsing accepts any value that ZoneId.of(String) understands; localized display names are not reverse-parsed.

  • Method Details

    • values

      public static TimeZoneFormat[] 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

      public static TimeZoneFormat valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • format

      public String format(TimeZone value)
      Formats the specified TimeZone using this format.
      Parameters:
      value - The value to format. Can be null (returns null).
      Returns:
      The formatted string, or null if value is null.
    • format

      public String format(ZoneId value)
      Formats the specified ZoneId using this format.
      Parameters:
      value - The value to format. Can be null (returns null).
      Returns:
      The formatted string, or null if value is null.
    • parseTimeZone

      public static TimeZone parseTimeZone(String value)
      Parses the specified wire value as a TimeZone.
      Parameters:
      value - The wire value. Can be null or blank (returns null).
      Returns:
      The parsed TimeZone, or null if value is null or blank.
    • parseZoneId

      public static ZoneId parseZoneId(String value)
      Parses the specified wire value as a ZoneId.
      Parameters:
      value - The wire value. Can be null or blank (returns null).
      Returns:
      The parsed ZoneId, or null if value is null or blank.