qflib 0.98.1

de.qfs.lib.option
Class FileOption

java.lang.Object
  |
  +--java.util.Observable
        |
        +--de.qfs.lib.option.Option
              |
              +--de.qfs.lib.option.FileOption
All Implemented Interfaces:
java.lang.Cloneable, ConfigurableOption, java.io.Serializable

public class FileOption
extends Option
implements ConfigurableOption

A FileOption's value is of class File. Additional flags determine, whether the file must exist and if it must be a file, a directory or can be either.

Version:
$Revision: 1.7 $
Author:
Gregor Schmid
See Also:
Serialized Form

Field Summary
static int ANY_TYPE
          The file may be either a plain file or a directory.
static int DIRECTORY_TYPE
          The file must be a directory.
static int FILE_TYPE
          The file must be a plain file.
 
Constructor Summary
FileOption()
          Create a new FileOption.
FileOption(java.lang.String name, java.io.File value)
          Create a new FileOption.
FileOption(java.lang.String name, java.io.File value, boolean nullOK, boolean mustExist, int fileType)
          Create a new FileOption.
 
Method Summary
 boolean equals(java.lang.Object object)
          Two FileOptions are considered equal if their names and values are equal.
 java.lang.String getConfigurableValue()
          Get the Option's value as a String.
 int getFileType()
          Get the fileType of the FileOption.
 boolean isMustExist()
          Get the mustExist state of the FileOption.
 void setConfigurableValue(java.lang.String val)
          Set the Option's value from a String.
 void setFileType(int fileType)
          Set the fileType of the FileOption.
 void setMustExist(boolean mustExist)
          Set the mustExist state of the FileOption.
 
Methods inherited from class de.qfs.lib.option.Option
addResources, addValidator, checkValue, clone, getName, getResources, getValue, hashCode, isNullOK, removeValidator, setName, setNullOK, setResources, setValue, toString
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANY_TYPE

public static final int ANY_TYPE
The file may be either a plain file or a directory.

FILE_TYPE

public static final int FILE_TYPE
The file must be a plain file.

DIRECTORY_TYPE

public static final int DIRECTORY_TYPE
The file must be a directory.
Constructor Detail

FileOption

public FileOption()
Create a new FileOption.

FileOption

public FileOption(java.lang.String name,
                  java.io.File value)
Create a new FileOption.
Parameters:
name - The name of the FileOption.
value - The initial value.

FileOption

public FileOption(java.lang.String name,
                  java.io.File value,
                  boolean nullOK,
                  boolean mustExist,
                  int fileType)
Create a new FileOption.
Parameters:
name - The name of the FileOption.
value - The initial value.
nullOK - Whether the value may be null.
mustExist - Whether the file must exist.
fileType - The type of the file.
Method Detail

isMustExist

public final boolean isMustExist()
Get the mustExist state of the FileOption.
Returns:
The mustExist state of the FileOption.

setMustExist

public final void setMustExist(boolean mustExist)
Set the mustExist state of the FileOption.
Parameters:
mustExist - The mustExist state to set.

getFileType

public final int getFileType()
Get the fileType of the FileOption.
Returns:
The fileType of the FileOption.

setFileType

public final void setFileType(int fileType)
Set the fileType of the FileOption.
Parameters:
fileType - The fileType to set.

equals

public boolean equals(java.lang.Object object)
Two FileOptions are considered equal if their names and values are equal.
Overrides:
equals in class Option
Parameters:
object - The object to compare to.
Returns:
True if objects are equal

getConfigurableValue

public java.lang.String getConfigurableValue()
Get the Option's value as a String.
Specified by:
getConfigurableValue in interface ConfigurableOption
Returns:
The Option's value as a String.

setConfigurableValue

public void setConfigurableValue(java.lang.String val)
Set the Option's value from a String.
Specified by:
setConfigurableValue in interface ConfigurableOption
Parameters:
val - The value to set.

qflib 0.98.1