Class LangTag


  • public class LangTag
    extends Object
    Class representation of RFC 5646 Language Tags allowing for retrieval of both the original String and the corresponding Locale.
    • Constructor Summary

      Constructors 
      Constructor Description
      LangTag​(String langTagStr)
      This constructor takes a RFC 5646 formatted String and converts it to a LangTag object consisting of a java.util.Locale object and the original String.
    • Constructor Detail

      • LangTag

        public LangTag​(String langTagStr)
                throws IllformedLocaleException
        This constructor takes a RFC 5646 formatted String and converts it to a LangTag object consisting of a java.util.Locale object and the original String.
        Parameters:
        langTagStr - The language tag String from an xAPI Statement language map.
        Throws:
        IllformedLocaleException - when the String is not a valid language tag.
    • Method Detail

      • toString

        public String toString()
        Returns the original String version of the LangTag.
        Overrides:
        toString in class Object
        Returns:
        LangTag as a String.
      • toLocale

        public Locale toLocale()
        Returns the java.util.Locale instance corresponding to the LangTag.
        Returns:
        The Locale.
      • equals

        public boolean equals​(Object langTag)
        Checks that this LangTag is equal to the langTag based on the orignal String (NOT the Locale).
        Overrides:
        equals in class Object
        Returns:
        true if the langTag is equal to this LangTag.
      • hashCode

        public int hashCode()
        Hashes the LangTag based on its original String value (NOT the Locale).
        Overrides:
        hashCode in class Object
        Returns:
        the hash code of the original String.