Package org.apache.sis.internal.jaxb.gco
Class CharSequenceAdapter
java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<GO_CharacterString,CharSequence>
org.apache.sis.internal.jaxb.gco.CharSequenceAdapter
- Direct Known Subclasses:
CharSequenceAdapter.Since2014
JAXB adapter wrapping the string value in a
<gco:CharacterString>
element, for ISO 19115-3 compliance.
A CharSequenceAdapter
can handle the following types:
InternationalString
, which may be mapped toPT_FreeText
elements.String
(actually any character sequences other thanInternationalString
).Anchor
, which can be substituted to any of the above if theReferenceResolver
in the current marshalling context maps the given text to axlink
.
- Since:
- 0.3
- Version:
- 1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Wraps the value only if marshalling ISO 19115-3 element. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmarshal
(CharSequence value) Converts a character sequence to the object to be marshalled in a XML file or stream.final CharSequence
unmarshal
(GO_CharacterString value) Converts a string read from a XML stream to the object containing the value.static CharSequence
Same aswrap(Context, Object, String)
, but returns directly theGO_CharacterString.text
value without wrapping in aGO_CharacterString
instance.(package private) static GO_CharacterString
wrap
(CharSequence value) Converts a character sequence to the object to be marshalled in a XML file or stream.static GO_CharacterString
Converts the string representation of an object to be marshalled in a XML file or stream.
-
Constructor Details
-
CharSequenceAdapter
public CharSequenceAdapter()Constructor for JAXB only.
-
-
Method Details
-
unmarshal
Converts a string read from a XML stream to the object containing the value. JAXB calls automatically this method at unmarshalling time.- Specified by:
unmarshal
in classXmlAdapter<GO_CharacterString,
CharSequence> - Parameters:
value
- the adapter for this metadata value.- Returns:
- a
CharSequence
which represents the metadata value.
-
marshal
Converts a character sequence 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,
CharSequence> - Parameters:
value
- the string value.- Returns:
- the wrapper for the given character sequence, or
null
.
-
wrap
Converts a character sequence to the object to be marshalled in a XML file or stream.- Parameters:
value
- the character representation of the object being marshalled.- Returns:
- the wrapper for the given character sequence, or
null
.
-
wrap
Converts the string representation of an object to be marshalled in a XML file or stream. This method is a copy ofwrap(CharSequence)
simplified for the case when we know that the character sequence being marshalled is a string.- Parameters:
context
- the current (un)marshalling context, ornull
if none.object
- the object being marshalled (e.g.URI
orLocale
).string
- the string representation of the object being marshalled.- Returns:
- the wrapper for the given character sequence, or
null
.
-
value
Same aswrap(Context, Object, String)
, but returns directly theGO_CharacterString.text
value without wrapping in aGO_CharacterString
instance.- Parameters:
context
- the current (un)marshalling context, ornull
if none.object
- the object being marshalled (e.g.URI
orLocale
).string
- the string representation of the object being marshalled.- Returns:
- the text value for the given character sequence, or
null
.
-