net.sf.freecol.common.option
Class FileOption

java.lang.Object
  extended by net.sf.freecol.common.model.FreeColObject
      extended by net.sf.freecol.common.option.AbstractOption<java.io.File>
          extended by net.sf.freecol.common.option.FileOption
All Implemented Interfaces:
java.lang.Cloneable, Option<java.io.File>

public class FileOption
extends AbstractOption<java.io.File>

Represents an option for specifying a File.


Field Summary
private static java.util.logging.Logger logger
           
private  java.io.File value
           
 
Fields inherited from class net.sf.freecol.common.option.AbstractOption
isDefined
 
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
FileOption(Specification specification)
          Creates a new FileOption.
 
Method Summary
 FileOption clone()
           
 java.io.File getValue()
          Gets the current value of this FileOption.
static java.lang.String getXMLElementTagName()
          Gets the tag name of the root element representing this object.
 boolean isNullValueOK()
          Returns whether null is an acceptable value for this Option.
 void setValue(java.io.File value)
          Sets the value of this FileOption.
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
generateChoices, getGroup, readAttributes, readFromXMLImpl, readOption, setGroup, setValues
 
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, setSpecification, toXML, toXML, toXML, toXMLElement, toXMLElement, toXMLElement, toXMLElement, toXMLElementPartial, toXMLPartialImpl, writeAttribute, writeChildren
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.freecol.common.option.Option
getId, readFromXML, toString, toXML
 

Field Detail

logger

private static java.util.logging.Logger logger

value

private java.io.File value
Constructor Detail

FileOption

public FileOption(Specification specification)
Creates a new FileOption.

Parameters:
specification - The specification this option belongs to. May be null.
Method Detail

clone

public FileOption clone()
Specified by:
clone in interface Option<java.io.File>
Specified by:
clone in class AbstractOption<java.io.File>

getValue

public java.io.File getValue()
Gets the current value of this FileOption.

Specified by:
getValue in interface Option<java.io.File>
Specified by:
getValue in class AbstractOption<java.io.File>
Returns:
The value using null for marking no value.

setValue

public void setValue(java.io.File value)
Sets the value of this FileOption.

Specified by:
setValue in interface Option<java.io.File>
Specified by:
setValue in class AbstractOption<java.io.File>
Parameters:
value - The value to be set.

setValue

protected void setValue(java.lang.String valueString,
                        java.lang.String defaultValueString)
Description copied from class: AbstractOption
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.io.File>
Parameters:
valueString - the string representation of the value of this Option
defaultValueString - the string representation of the default value of this Option

isNullValueOK

public boolean isNullValueOK()
Returns whether null is an acceptable value for this Option. This method always returns true.

Overrides:
isNullValueOK in class AbstractOption<java.io.File>
Returns:
true

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:
"fileOption".