Package org.apache.sis.internal.jaxb.lan
Class PT_Locale
java.lang.Object
org.apache.sis.internal.jaxb.lan.PT_Locale
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
A set ofPT_Locale
instances backed by aMap<Locale,Charset>
.private static final class
Wraps the"locale"
attributes in a"PT_Locale"
element. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PT_Locale.Wrapper
The attributes wrapped in a"PT_Locale"
element.private Locale
The wrapped locale, for information purpose. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) final boolean
Infers a locale and character set from this wrapper and adds them as an entry in the given map.static PT_Locale
Returns the first element of the given map, ornull
if none.(package private) final Charset
Returns the character set, ornull
if none.Returns the Java locale wrapped by thisPT_Locale
instance.(package private) final void
setCharacterSet
(Charset encoding) Sets the character set to the given value.Wraps all elements of the given map in a sequence ofPT_Locale
.
-
Field Details
-
locale
The wrapped locale, for information purpose. This object is not marshalled directly. Instead, it will be decomposed in language and country components inPT_Locale.Wrapper
.- See Also:
-
element
The attributes wrapped in a"PT_Locale"
element.
-
-
Constructor Details
-
PT_Locale
private PT_Locale()Empty constructor for JAXB only. -
PT_Locale
Creates a new wrapper for the given locale.- Parameters:
locale
- the language and country components ofPT_Locale
.
-
PT_Locale
Creates a new wrapper for the given locale and character set.- Parameters:
entry
- the locale to marshal together with its charset.
-
-
Method Details
-
getLocale
Returns the Java locale wrapped by thisPT_Locale
instance. This method returns a cached instance if possible.- Returns:
- the wrapped locale, or
null
if none.
-
getCharacterSet
Returns the character set, ornull
if none. -
setCharacterSet
Sets the character set to the given value. -
addInto
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
Returns the first element of the given map, ornull
if none.- Parameters:
locales
- the locales and character sets, ornull
.- Returns:
- the first element of the given map, or
null
.
-
wrap
Wraps all elements of the given map in a sequence ofPT_Locale
.- Parameters:
locales
- the locales and character sets, ornull
.- Returns:
- the all elements of the given map, or
null
if the given map is null or empty.
-