Class PT_Locale

java.lang.Object
org.apache.sis.internal.jaxb.lan.PT_Locale

public final class PT_Locale extends Object
A Locale associated to Charset. This class wraps 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 wrapper formats the locale like below: For an alternative (simpler) format used in the legacy gmd namespace, see LocaleAdapter.
Since:
0.3
Version:
1.0
See Also:
  • Field Details

    • locale

      private Locale locale
      The wrapped locale, for information purpose. This object is not marshalled directly. Instead, it will be decomposed in language and country components in PT_Locale.Wrapper.
      See Also:
    • element

      private PT_Locale.Wrapper element
      The attributes wrapped in a "PT_Locale" element.
  • Constructor Details

    • PT_Locale

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

      public PT_Locale(Locale locale)
      Creates a new wrapper for the given locale.
      Parameters:
      locale - the language and country components of PT_Locale.
    • PT_Locale

      private PT_Locale(Map.Entry<Locale,Charset> entry)
      Creates a new wrapper for the given locale and character set.
      Parameters:
      entry - the locale to marshal together with its charset.
  • Method Details

    • getLocale

      public Locale getLocale()
      Returns the Java locale wrapped by this PT_Locale instance. This method returns a cached instance if possible.
      Returns:
      the wrapped locale, or null if none.
    • getCharacterSet

      final Charset getCharacterSet()
      Returns the character set, or null if none.
    • setCharacterSet

      final void setCharacterSet(Charset encoding)
      Sets the character set to the given value.
    • addInto

      final boolean addInto(Map<Locale,Charset> addTo)
      Infers a locale and character set from this wrapper and adds them as an entry in the given map.
      Parameters:
      addTo - the map where to add an entry for the locale and character set.
      Returns:
      whether the given map has been modified.
    • first

      public static PT_Locale first(Map<Locale,Charset> locales)
      Returns the first element of the given map, or null if none.
      Parameters:
      locales - the locales and character sets, or null.
      Returns:
      the first element of the given map, or null.
    • wrap

      public static Set<PT_Locale> wrap(Map<Locale,Charset> locales)
      Wraps all elements of the given map in a sequence of PT_Locale.
      Parameters:
      locales - the locales and character sets, or null.
      Returns:
      the all elements of the given map, or null if the given map is null or empty.