net.sf.freecol.common.option
Class BooleanOption

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.option.AbstractOption<java.lang.Boolean>
          extended by net.sf.freecol.common.option.BooleanOption
All Implemented Interfaces:
Option

public class BooleanOption
extends AbstractOption<java.lang.Boolean>

Represents an option that can be either true or false.


Field Summary
private static java.util.logging.Logger logger
           
private  boolean value
           
 
Fields inherited from class net.sf.freecol.common.option.AbstractOption
isDefined, previewEnabled
 
Fields inherited from class net.sf.freecol.common.model.FreeColObject
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, INFINITY, NO_ID, PARTIAL_ATTRIBUTE, UNDEFINED, VALUE_TAG
 
Constructor Summary
BooleanOption(java.lang.String id)
          Creates a new BooleanOption.
BooleanOption(javax.xml.stream.XMLStreamReader in)
          Creates a new BooleanOption.
 
Method Summary
 java.lang.Boolean getValue()
          Gets the current value of this BooleanOption.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
 void setValue(java.lang.Boolean value)
          Sets the current value of this BooleanOption.
protected  void setValue(java.lang.String valueString, java.lang.String defaultValueString)
          Sets the value of this Option from the given string representation.
protected  void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
          This method writes an XML-representation of this object to the given stream.
protected  void writeAttributes(javax.xml.stream.XMLStreamWriter out)
          Write the attributes of this object to a stream.
 
Methods inherited from class net.sf.freecol.common.option.AbstractOption
getGroup, isPreviewEnabled, readAttributes, readFromXMLImpl, setGroup, setPreviewEnabled
 
Methods inherited from class net.sf.freecol.common.model.FreeColObject
addPropertyChangeListener, addPropertyChangeListener, dumpObject, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getId, getPropertyChangeListeners, getPropertyChangeListeners, getSpecification, hasAbility, hasAttribute, hasListeners, readAttributes, readChild, readChild, readChildren, readChildren, readFromArrayElement, readFromArrayElement, readFromListElement, readFromXML, readFromXMLElement, readFromXMLImpl, readFromXMLPartialImpl, removePropertyChangeListener, removePropertyChangeListener, save, save, setId, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.freecol.common.option.Option
addPropertyChangeListener, getId, readFromXML, readFromXMLElement, removePropertyChangeListener, toString, toXML, toXMLElement
 

Field Detail

logger

private static java.util.logging.Logger logger

value

private boolean value
Constructor Detail

BooleanOption

public BooleanOption(java.lang.String id)
Creates a new BooleanOption.

Parameters:
id - The identifier for this option. This is used when the object should be found in an OptionGroup.

BooleanOption

public BooleanOption(javax.xml.stream.XMLStreamReader in)
              throws javax.xml.stream.XMLStreamException
Creates a new BooleanOption.

Parameters:
in - The XMLStreamReader containing the data.
Throws:
javax.xml.stream.XMLStreamException - if an error occurs
Method Detail

getValue

public java.lang.Boolean getValue()
Gets the current value of this BooleanOption.

Specified by:
getValue in class AbstractOption<java.lang.Boolean>
Returns:
The value.

setValue

public void setValue(java.lang.Boolean value)
Sets the current value of this BooleanOption.

Specified by:
setValue in class AbstractOption<java.lang.Boolean>
Parameters:
value - The value.

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.

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

toXMLImpl

protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
                  throws javax.xml.stream.XMLStreamException
This method writes an XML-representation of this object to the given stream.

Specified by:
toXMLImpl in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

writeAttributes

protected void writeAttributes(javax.xml.stream.XMLStreamWriter out)
                        throws javax.xml.stream.XMLStreamException
Write the attributes of this object to a stream.

Overrides:
writeAttributes in class FreeColObject
Parameters:
out - The target stream.
Throws:
javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.

getXMLElementTagName

public static java.lang.String getXMLElementTagName()
Gets the tag name of the root element representing this object.

Returns:
"booleanOption".