Enum LocaleMatcher.Demotion

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      NONE
      All desired locales are treated equally.
      REGION
      Earlier desired locales are preferred.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Demotion()  
    • 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.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • 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] yields Result(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.)
    • Constructor Detail

      • Demotion

        private Demotion()
    • 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 name
        java.lang.NullPointerException - if the argument is null