java.lang.Object
org.exoplatform.services.rest.impl.header.Language
Direct Known Subclasses:
AcceptLanguage

public class Language extends Object
Reflection for HTTP language tag.
Version:
$Id: $
Author:
Andrey Parfonov
  • Constructor Details

    • Language

      public Language(Locale locale)
      Constructs new instance of Language.
      Parameters:
      locale - Locale
  • Method Details

    • getLocale

      public static Locale getLocale(String language)
      Create Locale from Language Tag string.
      Parameters:
      language - string representation of Language Tag See HTTP/1.1 documentation
      Returns:
      Locale
    • getPrimaryTag

      public String getPrimaryTag()
      Get primary-tag of language tag, e. g. if Language tag 'en-gb' then 'en' is primary-tag. See HTTP/1.1 documentation
      Returns:
      the primary-tag of Language tag
    • getSubTag

      public String getSubTag()
      Get sub-tag of language tag, e. g. if Language tag 'en-gb' then 'gb' is sub-tag. See HTTP/1.1 documentation
      Returns:
      the sub-tag of Language tag
    • getLocale

      public Locale getLocale()
      Returns:
      Locale
    • isCompatible

      public boolean isCompatible(Language other)
      Check is two Language instance is compatible.
      Parameters:
      other - checked language
      Returns:
      true if given Language is compatible with current false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object