Class StringAdapter

Direct Known Subclasses:
MimeFileTypeAdapter, StringAdapter.Since2014

public class StringAdapter extends XmlAdapter<GO_CharacterString,String>
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
  • Constructor Details

    • StringAdapter

      protected StringAdapter()
      Empty constructor for JAXB or subclasses.
  • Method Details

    • toString

      public static String toString(CharSequence text)
      Returns a string representation of the given character sequence. If the given sequence is an instance of InternationalString, then the locale from the current unmashalling context is used in order to get a string. If the context is null or does not specify any locale, then the choice of locale is left to the InternationalString.toString() implementation.
      Parameters:
      text - the CharSequence to convert to a String, or null.
      Returns:
      the localized representation of the given text, or null if the text was null.
      See Also:
    • toString

      static String toString(GO_CharacterString value)
      Returns the string representation of the given GO_CharacterString for the current locale. The locale is determined by the XML.LOCALE property given to the marshaller.
      Parameters:
      value - the wrapper for the value, or null.
      Returns:
      the string representation of the given text, or null.
    • unmarshal

      public String 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. If the character sequence is an instance of InternationalString, then the locale from the current unmashalling context is used in order to get a string.
      Specified by:
      unmarshal in class XmlAdapter<GO_CharacterString,String>
      Parameters:
      value - the wrapper for the value, or null.
      Returns:
      the unwrapped String value, or null.
    • marshal

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