Package org.apache.sis.internal.jaxb.gco
Class StringAdapter
java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<GO_CharacterString,String>
org.apache.sis.internal.jaxb.gco.StringAdapter
- Direct Known Subclasses:
MimeFileTypeAdapter
,StringAdapter.Since2014
JAXB adapter for XML
<GO_CharacterString>
element mapped to String
.
This adapter is similar to InternationalStringAdapter
, except that the unmarshal
method needs to localize InternationalString
instances for the locale specified in the
current marshaller context.- Since:
- 0.3
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Wraps the value only if marshalling ISO 19115-3 element. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Empty constructor for JAXB or subclasses. -
Method Summary
Modifier and TypeMethodDescriptionConverts a string to the object to be marshalled in a XML file or stream.static String
toString
(CharSequence text) Returns a string representation of the given character sequence.(package private) static String
toString
(GO_CharacterString value) Returns the string representation of the givenGO_CharacterString
for the current locale.unmarshal
(GO_CharacterString value) Converts a string read from a XML stream to the object containing the value.
-
Constructor Details
-
StringAdapter
protected StringAdapter()Empty constructor for JAXB or subclasses.
-
-
Method Details
-
toString
Returns a string representation of the given character sequence. If the given sequence is an instance ofInternationalString
, then the locale from the current unmashalling context is used in order to get a string. If the context isnull
or does not specify any locale, then the choice of locale is left to theInternationalString.toString()
implementation.- Parameters:
text
- theCharSequence
to convert to aString
, ornull
.- Returns:
- the localized representation of the given text, or
null
if the text was null. - See Also:
-
toString
Returns the string representation of the givenGO_CharacterString
for the current locale. The locale is determined by theXML.LOCALE
property given to the marshaller.- Parameters:
value
- the wrapper for the value, ornull
.- Returns:
- the string representation of the given text, or
null
.
-
unmarshal
Converts a string read from a XML stream to the object containing the value. JAXB calls automatically this method at unmarshalling time. If the character sequence is an instance ofInternationalString
, then the locale from the current unmashalling context is used in order to get a string.- Specified by:
unmarshal
in classXmlAdapter<GO_CharacterString,
String> - Parameters:
value
- the wrapper for the value, ornull
.- Returns:
- the unwrapped
String
value, ornull
.
-
marshal
Converts a string to the object to be marshalled in a XML file or stream. JAXB calls automatically this method at marshalling time.- Specified by:
marshal
in classXmlAdapter<GO_CharacterString,
String> - Parameters:
value
- the string value, ornull
.- Returns:
- the wrapper for the given string, or
null
.
-