Package com.helger.http.header.specific
Class AcceptLanguageList
java.lang.Object
com.helger.http.header.AbstractQValueList<String>
com.helger.http.header.specific.AcceptLanguageList
Represents a list of Accept-Language values as specified in the HTTP header
- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull AcceptLanguageListaddLanguage(@NonNull String sLanguage, double dQuality) Add a language with the given quality.booleanexplicitlySupportsLanguage(@NonNull String sLanguage) Check if the passed language is explicitly supported (without wildcard fallback).@NonNull StringdoublegetQualityOfLanguage(@NonNull String sLanguage) Return the associated quality of the given language.@NonNull QValuegetQValueOfLanguage(@NonNull String sLanguage) Return the associated quality of the given language.booleansupportsLanguage(@NonNull String sLanguage) Check if the passed language is supported.Methods inherited from class com.helger.http.header.AbstractQValueList
equals, getAllQValues, getAllQValuesGreaterOrEqual, getAllQValuesGreaterThan, getAllQValuesLowerOrEqual, getAllQValuesLowerThan, getAsHttpHeaderValue, getAsHttpHeaderValue, hashCode, qvalueMap, toString
-
Constructor Details
-
AcceptLanguageList
public AcceptLanguageList()Constructor creating an empty accept language list.
-
-
Method Details
-
addLanguage
public @NonNull AcceptLanguageList addLanguage(@NonNull String sLanguage, @Nonnegative double dQuality) Add a language with the given quality.- Parameters:
sLanguage- The language to add. May neither benullnor empty.dQuality- The quality value between 0 and 1.- Returns:
- this for chaining
-
getQValueOfLanguage
Return the associated quality of the given language.- Parameters:
sLanguage- The language name to query. May not benull.- Returns:
- The associated
QValue. Nevernull.
-
getQualityOfLanguage
Return the associated quality of the given language.- Parameters:
sLanguage- The language name to query. May not benull.- Returns:
- 0 means not accepted, 1 means fully accepted.
-
supportsLanguage
Check if the passed language is supported. Supported means the quality is > 0.- Parameters:
sLanguage- The language to be checked. May not benull.- Returns:
trueif the language is supported,falseif not.
-
explicitlySupportsLanguage
Check if the passed language is explicitly supported (without wildcard fallback). Supported means the quality is > 0.- Parameters:
sLanguage- The language to be checked. May not benull.- Returns:
trueif the language is explicitly supported,falseif not.
-
getAsHttpHeaderValue
- Specified by:
getAsHttpHeaderValuein classAbstractQValueList<String>- Returns:
- The string representation of this list e.g. for usage in HTTP headers.
-