Package com.ibm.icu.util
Enum LocaleMatcher.Demotion
- All Implemented Interfaces:
Serializable
,Comparable<LocaleMatcher.Demotion>
,java.lang.constant.Constable
- Enclosing class:
LocaleMatcher
Builder option for whether all desired locales are treated equally or
earlier ones are preferred.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic LocaleMatcher.Demotion
Returns the enum constant of this type with the specified name.static LocaleMatcher.Demotion[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
NONE
All desired locales are treated equally. -
REGION
Earlier desired locales are preferred.From each desired locale to the next, the distance to any supported locale is increased by an additional amount which is at least as large as most region mismatches. A later desired locale has to have a better match with some supported locale due to more than merely having the same region subtag.
For example:
Supported={en, sv} desired=[en-GB, sv]
yieldsResult(en-GB, en)
because with the demotion of sv its perfect match is no better than the region distance between the earlier desired locale en-GB and en=en-US.Notes:
- In some cases, language and/or script differences can be as small as the typical region difference. (Example: sr-Latn vs. sr-Cyrl)
- It is possible for certain region differences to be larger than usual, and larger than the demotion. (As of CLDR 35 there is no such case, but this is possible in future versions of the data.)
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-