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
- Author:
- Cédric Briançon (Geomatys), Martin Desruisseaux (Geomatys)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classWraps the value only if marshalling ISO 19115-3 element. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty 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 StringtoString(CharSequence text) Returns a string representation of the given character sequence.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 isnullor does not specify any locale, then the choice of locale is left to theInternationalString.toString()implementation.- Parameters:
text- theCharSequenceto convert to aString, ornull.- Returns:
- the localized representation of the given text, or
nullif the text was null. - See Also:
-
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:
unmarshalin classXmlAdapter<GO_CharacterString,String> - Parameters:
value- the wrapper for the value, ornull.- Returns:
- the unwrapped
Stringvalue, 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:
marshalin classXmlAdapter<GO_CharacterString,String> - Parameters:
value- the string value, ornull.- Returns:
- the wrapper for the given string, or
null.
-