Class BooleanOption

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

    public class BooleanOption
    extends AbstractOption<java.lang.Boolean>
    Represents an option that can be either true or false.
    • Field Detail

      • logger

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

        private boolean value
        The value of this option.
    • Constructor Detail

      • BooleanOption

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

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

      • getValue

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

        public void setValue​(java.lang.Boolean value)
        Sets the value of this option.
        Specified by:
        setValue in interface Option<java.lang.Boolean>
        Specified by:
        setValue in class AbstractOption<java.lang.Boolean>
        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.Boolean>
        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.Boolean>
        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.