Class FileParameter
- java.lang.Object
-
- elki.utilities.optionhandling.parameters.AbstractParameter<FileParameter,java.net.URI>
-
- elki.utilities.optionhandling.parameters.FileParameter
-
- All Implemented Interfaces:
Parameter<java.net.URI>
public class FileParameter extends AbstractParameter<FileParameter,java.net.URI>
Parameter class for a parameter specifying a file.- Since:
- 0.3
- Author:
- Steffi Wanka, Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileParameter.FileType
Available file types:FileParameter.FileType.INPUT_FILE
denotes an input file,FileParameter.FileType.OUTPUT_FILE
denotes an output file.
-
Field Summary
Fields Modifier and Type Field Description private FileParameter.FileType
fileType
The file type of this file parameter.-
Fields inherited from class elki.utilities.optionhandling.parameters.AbstractParameter
constraints, defaultValue, givenValue, optionalParameter, optionid
-
-
Constructor Summary
Constructors Constructor Description FileParameter(OptionID optionID, FileParameter.FileType fileType)
Constructs a file parameter with the given optionID, and file type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FileParameter.FileType
getFileType()
Get the file type (input / output)java.lang.String
getSyntax()
Returns a string representation of the parameter's type.java.lang.String
getValueAsString()
Get the value as string.boolean
grab(Parameterization config, java.util.function.Consumer<java.net.URI> consumer)
Get the parameter.protected java.net.URI
parseValue(java.lang.Object obj)
Parse a given value into the destination type.protected boolean
validate(java.net.URI obj)
Validate a value after parsing (e.g., do constraint checks!)-
Methods inherited from class elki.utilities.optionhandling.parameters.AbstractParameter
addConstraint, describeValues, getConstraints, getDefaultValue, getDefaultValueAsString, getOptionID, getValue, hasDefaultValue, isDefined, isOptional, isValid, setDefaultValue, setOptional, setValue, setValueInternal, tookDefaultValue, tryDefaultValue
-
-
-
-
Field Detail
-
fileType
private FileParameter.FileType fileType
The file type of this file parameter. Specifies if the file is an input of output file.
-
-
Constructor Detail
-
FileParameter
public FileParameter(OptionID optionID, FileParameter.FileType fileType)
Constructs a file parameter with the given optionID, and file type.- Parameters:
optionID
- optionID the unique id of the optionfileType
- the file type of this file parameter
-
-
Method Detail
-
getValueAsString
public java.lang.String getValueAsString()
Description copied from interface:Parameter
Get the value as string. May returnnull
- Returns:
- Value as string
-
parseValue
protected java.net.URI parseValue(java.lang.Object obj) throws ParameterException
Description copied from class:AbstractParameter
Parse a given value into the destination type.- Specified by:
parseValue
in classAbstractParameter<FileParameter,java.net.URI>
- Parameters:
obj
- Object to parse (may be a string representation!)- Returns:
- Parsed object
- Throws:
ParameterException
- when the object cannot be parsed.
-
validate
protected boolean validate(java.net.URI obj) throws ParameterException
Description copied from class:AbstractParameter
Validate a value after parsing (e.g., do constraint checks!)- Overrides:
validate
in classAbstractParameter<FileParameter,java.net.URI>
- Parameters:
obj
- Object to validate- Returns:
- true iff the object is valid for this parameter.
- Throws:
ParameterException
- when the object is not valid.
-
getSyntax
public java.lang.String getSyntax()
Returns a string representation of the parameter's type.- Returns:
- "<file_>"
-
getFileType
public FileParameter.FileType getFileType()
Get the file type (input / output)- Returns:
- file type
-
grab
public boolean grab(Parameterization config, java.util.function.Consumer<java.net.URI> consumer)
Get the parameter.- Parameters:
config
- Parameterizationconsumer
- Output consumer- Returns:
true
if valid
-
-