Enum LocaleMatcher.Direction

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<LocaleMatcher.Direction>
    Enclosing class:
    LocaleMatcher

    public static enum LocaleMatcher.Direction
    extends java.lang.Enum<LocaleMatcher.Direction>
    Builder option for whether to include or ignore one-way (fallback) match data. The LocaleMatcher uses CLDR languageMatch data which includes fallback (oneway=true) entries. Sometimes it is desirable to ignore those.

    For example, consider a web application with the UI in a given language, with a link to another, related web app. The link should include the UI language, and the target server may also use the client’s Accept-Language header data. The target server has its own list of supported languages. One may want to favor UI language consistency, that is, if there is a decent match for the original UI language, we want to use it, but not if it is merely a fallback.

    See Also:
    LocaleMatcher.Builder.setDirection(LocaleMatcher.Direction)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      ONLY_TWO_WAY
      Locale matching limited to two-way matches including e.g.
      WITH_ONE_WAY
      Locale matching includes one-way matches such as Breton→French.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static LocaleMatcher.Direction valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static LocaleMatcher.Direction[] 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

      • WITH_ONE_WAY

        public static final LocaleMatcher.Direction WITH_ONE_WAY
        Locale matching includes one-way matches such as Breton→French. (default)
      • ONLY_TWO_WAY

        public static final LocaleMatcher.Direction ONLY_TWO_WAY
        Locale matching limited to two-way matches including e.g. Danish↔Norwegian but ignoring one-way matches.
    • Method Detail

      • values

        public static LocaleMatcher.Direction[] 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.Direction c : LocaleMatcher.Direction.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.Direction 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