Class TextOption

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Comparable<FreeColObject>, ObjectWithId, Option<java.lang.String>

    public class TextOption
    extends AbstractOption<java.lang.String>
    Represents an option that can be an arbitrary string.
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • value

        private java.lang.String value
        The value of this option.
    • Constructor Detail

      • TextOption

        public TextOption​(Specification specification)
        Creates a new TextOption.
        Parameters:
        specification - The Specification to refer to.
      • TextOption

        public TextOption​(java.lang.String id,
                          Specification specification)
        Creates a new TextOption.
        Parameters:
        id - The object identifier.
        specification - The Specification to refer to.
    • Method Detail

      • getValue

        public java.lang.String getValue()
        Gets the value of this option.
        Specified by:
        getValue in interface Option<java.lang.String>
        Specified by:
        getValue in class AbstractOption<java.lang.String>
        Returns:
        The value of this Option.
      • setValue

        public void setValue​(java.lang.String value)
        Sets the value of this option.
        Specified by:
        setValue in interface Option<java.lang.String>
        Specified by:
        setValue in class AbstractOption<java.lang.String>
        Parameters:
        value - The new value of this Option.
      • setValue

        protected void setValue​(java.lang.String valueString,
                                java.lang.String defaultValueString)
        Sets the value of this option from the given string representation. Both parameters must not be null at the same time. This method does nothing. Override it if the option has a suitable string representation.
        Overrides:
        setValue in class AbstractOption<java.lang.String>
        Parameters:
        valueString - The string representation of the value of this Option.
        defaultValueString - The string representation of the default value of this Option.
      • writeAttributes

        protected void writeAttributes​(FreeColXMLWriter xw)
                                throws javax.xml.stream.XMLStreamException
        Write the attributes of this object to a stream. To be overridden if required by any object that has attributes and uses the toXML(FreeColXMLWriter, String) call.
        Overrides:
        writeAttributes in class AbstractOption<java.lang.String>
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.
      • getXMLTagName

        public java.lang.String getXMLTagName()
        Get the serialization tag for this object.
        Specified by:
        getXMLTagName in class FreeColObject
        Returns:
        The tag.