Package org.apache.juneau.marshall
Enum Class LocaleFormat
- All Implemented Interfaces:
Serializable,Comparable<LocaleFormat>,Constable
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)).
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionBCP 47 language tag (the default):"en-US" ,"zh-Hant-TW" .Sentinel meaning "no value configured" — falls through to the next-higher precedence level.Underscore-separated form:"en_US" ,"zh_TW" . -
Method Summary
Modifier and TypeMethodDescriptionFormats the specified value using this format.Parses the specified wire value using this format.static LocaleFormatReturns the enum constant of this class with the specified name.static LocaleFormat[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NOT_SET
Sentinel meaning "no value configured" — falls through to the next-higher precedence level. -
BCP_47
BCP 47 language tag (the default):"en-US" ,"zh-Hant-TW" .Round-trips through
Locale.toLanguageTag()/Locale.forLanguageTag(String). -
UNDERSCORE
Underscore-separated form:"en_US" ,"zh_TW" .Round-trips through
Locale.toString()on the format side and a hand-rolled parser (language + country + variant tokens) on the parse side. Script subtags are not representable.
-
-
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 ).- 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 ).- Returns:
- The parsed
Locale, ornull ifvalueisnull or blank.
-