public class FileParameter extends AbstractParameter<FileParameter,File>
Modifier and Type | Class and Description |
---|---|
static class |
FileParameter.FileType
Available file types:
FileParameter.FileType.INPUT_FILE denotes an input file,
FileParameter.FileType.OUTPUT_FILE denotes an output file. |
Modifier and Type | Field and Description |
---|---|
private FileParameter.FileType |
fileType
The file type of this file parameter.
|
constraints, defaultValue, givenValue, optionalParameter, optionid, shortDescription
Constructor and Description |
---|
FileParameter(OptionID optionID,
FileParameter.FileType fileType)
Constructs a file parameter with the given optionID, and file type.
|
FileParameter(OptionID optionID,
FileParameter.FileType fileType,
boolean optional)
Constructs a file parameter with the given optionID, file type, and
optional flag.
|
Modifier and Type | Method and Description |
---|---|
FileParameter.FileType |
getFileType()
Get the file type (input / output)
|
String |
getSyntax()
Returns a string representation of the parameter's type.
|
String |
getValueAsString()
Get the value as string.
|
protected File |
parseValue(Object obj)
Parse a given value into the destination type.
|
protected boolean |
validate(File obj)
Validate a value after parsing (e.g. do constrain checks!)
|
addConstraint, getDefaultValue, getDefaultValueAsString, getFullDescription, getGivenValue, getName, getOptionID, getShortDescription, getValue, getValuesDescription, hasDefaultValue, hasValuesDescription, isDefined, isOptional, isValid, setDefaultValue, setOptional, setShortDescription, setValue, setValueInternal, tookDefaultValue, tryDefaultValue, useDefaultValue
private FileParameter.FileType fileType
public FileParameter(OptionID optionID, FileParameter.FileType fileType)
optionID
- optionID the unique id of the optionfileType
- the file type of this file parameterpublic FileParameter(OptionID optionID, FileParameter.FileType fileType, boolean optional)
optionID
- optionID the unique id of the optionfileType
- the file type of this file parameteroptional
- specifies if this parameter is an optional parameterpublic String getValueAsString()
Parameter
null
getValueAsString
in interface Parameter<File>
getValueAsString
in class AbstractParameter<FileParameter,File>
protected File parseValue(Object obj) throws ParameterException
AbstractParameter
parseValue
in class AbstractParameter<FileParameter,File>
obj
- Object to parse (may be a string representation!)ParameterException
- when the object cannot be parsed.protected boolean validate(File obj) throws ParameterException
AbstractParameter
validate
in class AbstractParameter<FileParameter,File>
obj
- Object to validateParameterException
- when the object is not valid.public String getSyntax()
getSyntax
in interface Parameter<File>
getSyntax
in class AbstractParameter<FileParameter,File>
public FileParameter.FileType getFileType()