org.apache.abdera.i18n.rfc4646
Class Lang

java.lang.Object
  extended by org.apache.abdera.i18n.rfc4646.Lang
All Implemented Interfaces:
Serializable, Cloneable, Comparable<org.apache.abdera.i18n.rfc4646.SubtagSet>, Iterable<Subtag>

public final class Lang
extends Object

Implementation of RFC 4646 Language Tags

See Also:
Serialized Form

Field Summary
protected  Subtag primary
           
 
Constructor Summary
Lang()
          Create a Lang object using the default locale
Lang(Locale locale)
          Create a Lang object using the specified locale
Lang(String lang)
          Create a lang object
 
Method Summary
 List<Subtag> asList()
           
 Range asRange()
          Get this Lang as a Language-Range for use with matching
 Lang canonicalize()
          Produce a canonicalized copy of this lang tag
 Lang clone()
          Clone this Language tag
 int compareTo(org.apache.abdera.i18n.rfc4646.SubtagSet o)
           
 boolean contains(String tag)
           
 boolean contains(String tag, Subtag.Type type)
           
 boolean contains(Subtag subtag)
           
 int count()
           
 boolean equals(Object obj)
           
static String fromLocale(Locale locale)
           
 Subtag get(int index)
           
 Subtag getExtension()
          Get the beginning of the extension section.
 Subtag getExtLang()
          Get the Extlang tag.
 Subtag getLanguage()
          Get the Language subtag
 Locale getLocale()
          Get a Locale object derived from this language tag
 Lang getParent()
          Get a Lang tag that drops the last subtag
 Subtag getPrivateUse()
          Get the beginning of the private-use section.
 Subtag getRegion()
          Get the Region subtag
 Subtag getScript()
          Get the Script subtag
 Subtag getVariant()
          Get the Variant subtag
 int hashCode()
           
 boolean isChildOf(Lang lang)
          Return true if the specified lang tag is the parent of this one
 boolean isDeprecated()
          Return true if this lang tag contains any deprecated subtags
 boolean isParentOf(Lang lang)
          Return true if the specified lang tag is the child of this one
 boolean isValid()
           
 Iterator<Subtag> iterator()
           
 int length()
           
static Lang parse(String lang)
          Parse a Lang tag
 Subtag[] toArray()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

primary

protected final Subtag primary
Constructor Detail

Lang

public Lang()
Create a Lang object using the default locale


Lang

public Lang(Locale locale)
Create a Lang object using the specified locale


Lang

public Lang(String lang)
Create a lang object

Method Detail

getLanguage

public Subtag getLanguage()
Get the Language subtag


getLocale

public 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

Overrides:
clone in class Object

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(String lang)
Parse a Lang tag


fromLocale

public static String fromLocale(Locale locale)

toString

public String toString()
Overrides:
toString in class Object

iterator

public Iterator<Subtag> iterator()
Specified by:
iterator in interface Iterable<Subtag>

contains

public boolean contains(Subtag subtag)

contains

public boolean contains(String tag)

contains

public boolean contains(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:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toArray

public Subtag[] toArray()

asList

public List<Subtag> asList()

compareTo

public int compareTo(org.apache.abdera.i18n.rfc4646.SubtagSet o)
Specified by:
compareTo in interface Comparable<org.apache.abdera.i18n.rfc4646.SubtagSet>


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.