public final class QLanguage extends Object implements Cloneable, ILanguage
The to string value is calculated when first accessed and cached subsequently. The value is
checked and set atomically. Concurrent access may cause different String objects to be cached and
returned but they will be equal. A happens before relationship is not established by calls to
toString()
.
Constructor and Description |
---|
QLanguage(String language,
String subLanguage,
double qualifier)
Constructor for qualified languages.
|
Modifier and Type | Method and Description |
---|---|
QLanguage |
clone()
Deprecated.
There is not real value in cloning this object, the only mutable value is the
cached toString value
|
boolean |
equals(Object object) |
double |
getQualifier()
The qualified weighting.
|
static List<ILanguage> |
getRequestLanguages(HttpServletRequest request)
Parser for HttpServletRequest to QLanguage.
|
int |
hashCode() |
boolean |
sameLangauge(ILanguage lang)
Test to see if two accept-language header values match.
|
String |
toString()
Returns a string representation of the object.
|
public QLanguage(String language, String subLanguage, double qualifier)
language
- The languagesubLanguage
- The sublanguagequalifier
- The qualifier of the languageIllegalArgumentException
- If the language or sublanguage is null or if the qualifier is less than zero or
greater than onepublic static List<ILanguage> getRequestLanguages(HttpServletRequest request) throws UnParsableHeaderException
request
- The HTTP request to parseUnParsableHeaderException
public String toString()
The string representation of the object is constructed lazily, it may be initialised multiple times and may not be aware of other threads setting it. The objects returned will be equal regardless of the thread returning the value.
toString
in class Object
Object.toString()
public final double getQualifier()
Qualified
getQualifier
in interface Qualified
public final boolean sameLangauge(ILanguage lang)
ILanguage
sameLangauge
in interface ILanguage
lang
- The languagetrue
if the same languageILanguage.sameLangauge(ILanguage)
@Deprecated public QLanguage clone()
clone
in class Object
Object.clone()
Copyright © 2016. All Rights Reserved.