Class FileOption

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

    public class FileOption
    extends AbstractOption<java.io.File>
    Represents an option for specifying a File.
    • Field Detail

      • logger

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

        private java.io.File value
        The value of this option.
      • type

        private java.lang.String type
        Extra optional qualifier for what the file is to be used for.
    • Constructor Detail

      • FileOption

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

      • getType

        public java.lang.String getType()
        Trivial type accessor.
        Returns:
        The type.
      • setType

        public void setType​(java.lang.String type)
        Trivial type mutator.
        Parameters:
        type - The new type.
      • getValue

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

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

        public boolean isNullValueOK()
        Is null an acceptable value for this option? Override this in subclasses where necessary.
        Overrides:
        isNullValueOK in class AbstractOption<java.io.File>
        Returns:
        False.
      • 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.io.File>
        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.io.File>
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.
      • readAttributes

        protected void readAttributes​(FreeColXMLReader xr)
                               throws javax.xml.stream.XMLStreamException
        Reads the attributes of this object from an XML stream.
        Overrides:
        readAttributes in class AbstractOption<java.io.File>
        Parameters:
        xr - The FreeColXMLReader to read from.
        Throws:
        javax.xml.stream.XMLStreamException - if there is a problem reading the stream.
      • getXMLTagName

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