Class LanguageCode

java.lang.Object
org.apache.sis.internal.jaxb.gco.GO_CharacterString
org.apache.sis.internal.jaxb.lan.LanguageCode

public final class LanguageCode extends GO_CharacterString
JAXB wrapper for Locale in order to wrap the value in an XML element as specified by ISO 19115-3 standard. See package documentation for more information about the handling of CodeList in ISO 19115-3.

This adapter formats the locale like below (by LocaleAdapter):

or (when using PT_Locale adapter): Note that <gco:CharacterString> can be substituted to the language code.
Since:
0.3
Version:
1.0
  • Field Details

    • identifier

      private CodeListUID identifier
      The language using a CodeList-like format.
  • Constructor Details

    • LanguageCode

      private LanguageCode()
      Empty constructor for JAXB only.
    • LanguageCode

      private LanguageCode(CharSequence code)
      Builds a <gco:LanguageCode> element. For private use by create(Context, Locale) only.
    • LanguageCode

      private LanguageCode(Context context, String codeListValue, String codeSpace, String value)
      Builds a <LanguageCode> element. For private use by create(Context, Locale) only.
      Parameters:
      context - the current (un)marshalling context, or null if none.
      codeListValue - the codeListValue attribute in the XML element.
      codeSpace - the 3-letters language code of the value attribute, or null if none.
      value - the value in the language specified by the codeSpace attribute, or null if none.
  • Method Details

    • create

      public static LanguageCode create(Context context, Locale locale)
      Creates a new wrapper for the given locale.
      Parameters:
      context - the current (un)marshalling context, or null if none.
      locale - the value to marshal, or null.
      Returns:
      the language to marshal, or null if the given locale was null or if its Locale.getLanguage() attribute is the empty string.
    • marshalLocale

      static Locale marshalLocale(Context context)
      Returns the locale to use at marshalling time, or the default locale if unspecified.
    • getLanguage

      public String getLanguage()
      Returns the language, or null if none. The language is expected to be a 2- or 3-letters ISO 639 code, but this is not verified by this method.
      Returns:
      the language code