Class GO_CharacterString

java.lang.Object
org.apache.sis.internal.jaxb.gco.GO_CharacterString
Direct Known Subclasses:
Country, LanguageCode, PT_FreeText

public class GO_CharacterString extends Object
JAXB wrapper for string value in a <gco:CharacterString>, <gcx:Anchor>, <gcx:FileName> or <gcx:MimeFileType> element, for ISO 19115-3 compliance.

FileName and MimeFileType are possible substitutions for CharacterString. They make sense only in DefaultBrowseGraphic or other classes using URI, but the XML schema does not prevent their usage in place of other strings. Consequently, we unconditionally accept FileName and MimeFileType at unmarshalling time. However, marshalling will use the appropriate element for the kind of property to marshal.

<gco:CharacterString> can also be replaced by CodeList or some Enum instances. See Types javadoc for an example.

Since:
0.3
Version:
1.0
Author:
Cédric Briançon (Geomatys), Martin Desruisseaux (Geomatys), Cullen Rombach (Image Matters)
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    Value assigned to type if the character string shall be marshalled as a <gcx:FileName> element.
    static final byte
    Value assigned to type if the character string shall be marshalled as a <gcx:MimeFileType> element.
    byte
    0 if the text shall be marshalled as a <gco:CharacterString>, or one of the static constants in this class otherwise.
    static final byte
    Value assigned to type if the character string shall be marshalled as a legacy <gmd:URL> element.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Empty constructor for JAXB and subclasses.
    protected
    Builds a wrapper for the given text.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected CharSequence
    Returns the content of this <gco:CharacterString> as a String, an InternationalString or an Anchor.
    final String
    Returns the text as a string, or null if none.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • MIME_TYPE

      public static final byte MIME_TYPE
      Value assigned to type if the character string shall be marshalled as a <gcx:MimeFileType> element.
      See Also:
    • FILENAME

      public static final byte FILENAME
      Value assigned to type if the character string shall be marshalled as a <gcx:FileName> element.
      See Also:
    • URL

      public static final byte URL
      Value assigned to type if the character string shall be marshalled as a legacy <gmd:URL> element.
      See Also:
    • type

      public byte type
      0 if the text shall be marshalled as a <gco:CharacterString>, or one of the static constants in this class otherwise.
      See Also:
  • Constructor Details

    • GO_CharacterString

      protected GO_CharacterString()
      Empty constructor for JAXB and subclasses.
    • GO_CharacterString

      protected GO_CharacterString(CharSequence text)
      Builds a wrapper for the given text.
      Parameters:
      text - the string to marshal, or null if none.
  • Method Details

    • toCharSequence

      protected CharSequence toCharSequence()
      Returns the content of this <gco:CharacterString> as a String, an InternationalString or an Anchor. This method is overridden by PT_FreeText in order to handle the international string case.
      Returns:
      the character sequence for this <gco:CharacterString>.
    • toString

      public final String toString()
      Returns the text as a string, or null if none. The null value is expected by various PT_FreeText.
      Note: Returning null is unusual and not a recommended practice. But precedents exist (for example DefaultMutableTreeNode) and this class is not for public usage.
      Overrides:
      toString in class Object
      Returns:
      the text as a string (may be null).