Class LocalePriorityList.Builder

  • Enclosing class:
    LocalePriorityList

    public static class LocalePriorityList.Builder
    extends Object
    Class used for building LanguagePriorityLists
    • Method Detail

      • build

        public LocalePriorityList build​(boolean preserveWeights)
        Creates a LocalePriorityList.
        Parameters:
        preserveWeights - when true, the weights originally came from a language priority list specified by add() are preserved.
        Returns:
        A LocalePriorityList
      • add

        public LocalePriorityList.Builder add​(ULocale languageCode)
        Adds a new language code, with weight = 1.0.
        Parameters:
        languageCode - to add with weight 1.0
        Returns:
        this, for chaining
      • add

        public LocalePriorityList.Builder add​(ULocale... languageCodes)
        Adds language codes, with each having weight = 1.0.
        Parameters:
        languageCodes - List of language codes.
        Returns:
        this, for chaining.
      • add

        public LocalePriorityList.Builder add​(ULocale languageCode,
                                              double weight)
        Adds a new supported languageCode, with specified weight. Overrides any previous weight for the language.
        Parameters:
        languageCode - language/locale to add
        weight - value between 0.0 and 1.1
        Returns:
        this, for chaining.
      • add

        public LocalePriorityList.Builder add​(String acceptLanguageList)
        Adds rfc2616 list.
        Parameters:
        acceptLanguageList - in rfc2616 format
        Returns:
        this, for chaining.