Package com.ibm.icu.util
Enum LocaleMatcher.Demotion
- java.lang.Object
-
- java.lang.Enum<LocaleMatcher.Demotion>
-
- com.ibm.icu.util.LocaleMatcher.Demotion
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<LocaleMatcher.Demotion>
- Enclosing class:
- LocaleMatcher
public static enum LocaleMatcher.Demotion extends java.lang.Enum<LocaleMatcher.Demotion>
Builder option for whether all desired locales are treated equally or earlier ones are preferred.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LocaleMatcher.Demotion
valueOf(java.lang.String name)
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 Detail
-
NONE
public static final LocaleMatcher.Demotion NONE
All desired locales are treated equally.
-
REGION
public static final LocaleMatcher.Demotion 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 Detail
-
values
public static LocaleMatcher.Demotion[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (LocaleMatcher.Demotion c : LocaleMatcher.Demotion.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static LocaleMatcher.Demotion valueOf(java.lang.String name)
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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
-