Package org.restlet.client.data
Class Language
- java.lang.Object
-
- org.restlet.client.data.Metadata
-
- org.restlet.client.data.Language
-
public final class Language extends Metadata
Language used in representations and preferences. A language tag is composed of one or more parts: A primary language tag and a possibly empty series of sub-tags. When formatted as a string, parts are separated by hyphens.- Author:
- Jerome Louvel
-
-
Field Summary
Fields Modifier and Type Field Description static LanguageALLAll languages acceptable.static LanguageDEFAULTstatic LanguageENGLISHEnglish language.static LanguageENGLISH_USEnglish language spoken in USA.static LanguageFRENCHFrench language.static LanguageFRENCH_FRANCEFrench language spoken in France.static LanguageSPANISHSpanish language.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object object)LanguagegetParent()Returns the parent metadata if available or null.java.lang.StringgetPrimaryTag()Returns the primary tag.java.util.List<java.lang.String>getSubTags()Returns the unmodifiable list of subtags.inthashCode()booleanincludes(Metadata included)Indicates if a given language is included in the current one.static LanguagevalueOf(java.lang.String name)Returns the language associated to a name.-
Methods inherited from class org.restlet.client.data.Metadata
getDescription, getName, isCompatible, toString
-
-
-
-
Field Detail
-
ALL
public static final Language ALL
All languages acceptable.
-
DEFAULT
public static final Language DEFAULT
-
ENGLISH
public static final Language ENGLISH
English language.
-
ENGLISH_US
public static final Language ENGLISH_US
English language spoken in USA.
-
FRENCH
public static final Language FRENCH
French language.
-
FRENCH_FRANCE
public static final Language FRENCH_FRANCE
French language spoken in France.
-
SPANISH
public static final Language SPANISH
Spanish language.
-
-
Method Detail
-
valueOf
public static Language valueOf(java.lang.String name)
Returns the language associated to a name. If an existing constant exists then it is returned, otherwise a new instance is created.- Parameters:
name- The name.- Returns:
- The associated language.
-
getParent
public Language getParent()
Description copied from class:MetadataReturns the parent metadata if available or null.
-
getPrimaryTag
public java.lang.String getPrimaryTag()
Returns the primary tag.- Returns:
- The primary tag.
-
getSubTags
public java.util.List<java.lang.String> getSubTags()
Returns the unmodifiable list of subtags. This list can be empty.- Returns:
- The list of subtags for this language Tag.
-
includes
public boolean includes(Metadata included)
Indicates if a given language is included in the current one. The test is true if both languages are equal or if the given language is within the range of the current one. For example, ALL includes all languages. A null language is considered as included into the current one.Examples:
- ENGLISH.includes(ENGLISH_US) returns true
- ENGLISH_US.includes(ENGLISH) returns false
- Specified by:
includesin classMetadata- Parameters:
included- The language to test for inclusion.- Returns:
- True if the language type is included in the current one.
- See Also:
Metadata.isCompatible(Metadata)
-
-