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 classFileParameter.FileTypeAvailable file types:FileParameter.FileType.INPUT_FILEdenotes an input file,FileParameter.FileType.OUTPUT_FILEdenotes an output file.
-
Field Summary
Fields Modifier and Type Field Description private FileParameter.FileTypefileTypeThe 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.FileTypegetFileType()Get the file type (input / output)java.lang.StringgetSyntax()Returns a string representation of the parameter's type.java.lang.StringgetValueAsString()Get the value as string.booleangrab(Parameterization config, java.util.function.Consumer<java.net.URI> consumer)Get the parameter.protected java.net.URIparseValue(java.lang.Object obj)Parse a given value into the destination type.protected booleanvalidate(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:ParameterGet the value as string. May returnnull- Returns:
- Value as string
-
parseValue
protected java.net.URI parseValue(java.lang.Object obj) throws ParameterExceptionDescription copied from class:AbstractParameterParse a given value into the destination type.- Specified by:
parseValuein 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 ParameterExceptionDescription copied from class:AbstractParameterValidate a value after parsing (e.g., do constraint checks!)- Overrides:
validatein 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:
trueif valid
-
-