Class CharSequenceAdapter

Direct Known Subclasses:
CharSequenceAdapter.Since2014

public class CharSequenceAdapter extends XmlAdapter<GO_CharacterString,CharSequence>
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 to PT_FreeText elements.
  • String (actually any character sequences other than InternationalString).
  • Anchor, which can be substituted to any of the above if the ReferenceResolver in the current marshalling context maps the given text to a xlink.
Since:
0.3
Version:
1.0
See Also:
  • Constructor Details

    • CharSequenceAdapter

      public CharSequenceAdapter()
      Constructor for JAXB only.
  • Method Details

    • unmarshal

      public final CharSequence unmarshal(GO_CharacterString value)
      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 class XmlAdapter<GO_CharacterString,CharSequence>
      Parameters:
      value - the adapter for this metadata value.
      Returns:
      a CharSequence which represents the metadata value.
    • marshal

      public GO_CharacterString marshal(CharSequence value)
      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 class XmlAdapter<GO_CharacterString,CharSequence>
      Parameters:
      value - the string value.
      Returns:
      the wrapper for the given character sequence, or null.
    • wrap

      static GO_CharacterString wrap(CharSequence value)
      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

      public static GO_CharacterString wrap(Context context, Object object, String string)
      Converts the string representation of an object to be marshalled in a XML file or stream. This method is a copy of wrap(CharSequence) simplified for the case when we know that the character sequence being marshalled is a string.
      Parameters:
      context - the current (un)marshalling context, or null if none.
      object - the object being marshalled (e.g. URI or Locale).
      string - the string representation of the object being marshalled.
      Returns:
      the wrapper for the given character sequence, or null.
    • value

      public static CharSequence value(Context context, Object object, String string)
      Same as wrap(Context, Object, String), but returns directly the GO_CharacterString.text value without wrapping in a GO_CharacterString instance.
      Parameters:
      context - the current (un)marshalling context, or null if none.
      object - the object being marshalled (e.g. URI or Locale).
      string - the string representation of the object being marshalled.
      Returns:
      the text value for the given character sequence, or null.