Class 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.Object
    Implementation of RFC 4646 Language Tags
    See Also:
    Serialized Form
    • Constructor Detail

      • Lang

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

        public Lang​(java.util.Locale locale)
        Create a Lang object using the specified locale
      • Lang

        public Lang​(java.lang.String lang)
        Create a lang object
    • 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:
        toString in class java.lang.Object
      • iterator

        public java.util.Iterator<Subtag> iterator()
        Specified by:
        iterator in interface java.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:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.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:
        compareTo in interface java.lang.Comparable<org.apache.abdera.i18n.rfc4646.SubtagSet>