Package org.apache.abdera.i18n.rfc4646
Class Lang
- java.lang.Object
-
- org.apache.abdera.i18n.rfc4646.Lang
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<org.apache.abdera.i18n.rfc4646.SubtagSet>,java.lang.Iterable<Subtag>
public final class Lang extends java.lang.ObjectImplementation of RFC 4646 Language Tags- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Subtag>asList()RangeasRange()Get this Lang as a Language-Range for use with matchingLangcanonicalize()Produce a canonicalized copy of this lang tagLangclone()Clone this Language tagintcompareTo(org.apache.abdera.i18n.rfc4646.SubtagSet o)booleancontains(java.lang.String tag)booleancontains(java.lang.String tag, Subtag.Type type)booleancontains(Subtag subtag)intcount()booleanequals(java.lang.Object obj)static java.lang.StringfromLocale(java.util.Locale locale)Subtagget(int index)SubtaggetExtension()Get the beginning of the extension section.SubtaggetExtLang()Get the Extlang tag.SubtaggetLanguage()Get the Language subtagjava.util.LocalegetLocale()Get a Locale object derived from this language tagLanggetParent()Get a Lang tag that drops the last subtagSubtaggetPrivateUse()Get the beginning of the private-use section.SubtaggetRegion()Get the Region subtagSubtaggetScript()Get the Script subtagSubtaggetVariant()Get the Variant subtaginthashCode()booleanisChildOf(Lang lang)Return true if the specified lang tag is the parent of this onebooleanisDeprecated()Return true if this lang tag contains any deprecated subtagsbooleanisParentOf(Lang lang)Return true if the specified lang tag is the child of this onebooleanisValid()java.util.Iterator<Subtag>iterator()intlength()static Langparse(java.lang.String lang)Parse a Lang tagSubtag[]toArray()java.lang.StringtoString()
-
-
-
Method Detail
-
getLanguage
public Subtag getLanguage()
Get the Language subtag
-
getLocale
public java.util.Locale getLocale()
Get a Locale object derived from this language tag
-
getExtLang
public Subtag getExtLang()
Get the Extlang tag. If there are multiple extlang tags, this will return the first one. The rest can be retrieved by following Subtag.getNext()
-
getScript
public Subtag getScript()
Get the Script subtag
-
getRegion
public Subtag getRegion()
Get the Region subtag
-
getVariant
public Subtag getVariant()
Get the Variant subtag
-
getExtension
public Subtag getExtension()
Get the beginning of the extension section. This will return the first prefix subtag of the first set of extension subtags.
-
getPrivateUse
public Subtag getPrivateUse()
Get the beginning of the private-use section. This will return the x prefix subtag
-
asRange
public Range asRange()
Get this Lang as a Language-Range for use with matching
-
clone
public Lang clone()
Clone this Language tag
-
canonicalize
public Lang canonicalize()
Produce a canonicalized copy of this lang tag
-
isDeprecated
public boolean isDeprecated()
Return true if this lang tag contains any deprecated subtags
-
getParent
public Lang getParent()
Get a Lang tag that drops the last subtag
-
isChildOf
public boolean isChildOf(Lang lang)
Return true if the specified lang tag is the parent of this one
-
isParentOf
public boolean isParentOf(Lang lang)
Return true if the specified lang tag is the child of this one
-
parse
public static Lang parse(java.lang.String lang)
Parse a Lang tag
-
fromLocale
public static java.lang.String fromLocale(java.util.Locale locale)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
iterator
public java.util.Iterator<Subtag> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<Subtag>
-
contains
public boolean contains(Subtag subtag)
-
contains
public boolean contains(java.lang.String tag)
-
contains
public boolean contains(java.lang.String tag, Subtag.Type type)
-
length
public int length()
-
isValid
public boolean isValid()
-
count
public int count()
-
get
public Subtag get(int index)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toArray
public Subtag[] toArray()
-
asList
public java.util.List<Subtag> asList()
-
compareTo
public int compareTo(org.apache.abdera.i18n.rfc4646.SubtagSet o)
- Specified by:
compareToin interfacejava.lang.Comparable<org.apache.abdera.i18n.rfc4646.SubtagSet>
-
-