Enum Class LocaleFormat

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

public enum LocaleFormat extends Enum<LocaleFormat>
Supported wire formats for Locale values.

Used by MarshallingContext.Builder.localeFormat(LocaleFormat), Marshalled.localeFormat(), MarshalledProp.localeFormat(), and MarshalledConfig.localeFormat() to control how Locale values are written to and read from the wire.

The default is BCP_47 which preserves the historical wire output produced before this enum existed (Locale.toLanguageTag() / Locale.forLanguageTag(String)).

  • Enum Constant Details

  • Method Details

    • values

      public static LocaleFormat[] 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 LocaleFormat 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(Locale value)
      Formats the specified value using this format.
      Parameters:
      value - The value to format. Can be null (returns null).
      Returns:
      The formatted string, or null if value is null.
    • parse

      public Locale parse(String value)
      Parses the specified wire value using this format.
      Parameters:
      value - The wire value. Can be null or blank (returns null).
      Returns:
      The parsed Locale, or null if value is null or blank.