Package org.restlet.data
Class Language
java.lang.Object
org.restlet.data.Metadata
org.restlet.data.Language
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
FieldsModifier and TypeFieldDescriptionstatic final LanguageAll languages acceptable.static final LanguageThe default language of the JVM.static final LanguageEnglish language.static final LanguageEnglish language spoken in USA.static final LanguageFrench language.static final LanguageFrench language spoken in France.static final LanguageSpanish language. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the parent metadata if available or null.Returns the primary tag.Returns the unmodifiable list of subtags.inthashCode()booleanIndicates if a given language is included in the current one.static LanguageReturns the language associated to a name.Methods inherited from class org.restlet.data.Metadata
getDescription, getName, isCompatible, toString
-
Field Details
-
ALL
All languages acceptable. -
DEFAULT
The default language of the JVM.- See Also:
-
ENGLISH
English language. -
ENGLISH_US
English language spoken in USA. -
FRENCH
French language. -
FRENCH_FRANCE
French language spoken in France. -
SPANISH
Spanish language.
-
-
Constructor Details
-
Language
Constructor.- Parameters:
name- The name.
-
Language
Constructor.- Parameters:
name- The name.description- The description.
-
-
Method Details
-
valueOf
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.
-
equals
-
getParent
Description copied from class:MetadataReturns the parent metadata if available or null. -
getPrimaryTag
Returns the primary tag.- Returns:
- The primary tag.
-
getSubTags
Returns the unmodifiable list of subtags. This list can be empty.- Returns:
- The list of subtags for this language Tag.
-
hashCode
public int hashCode() -
includes
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
-