Class StringParameter
- java.lang.Object
-
- elki.utilities.optionhandling.parameters.AbstractParameter<StringParameter,java.lang.String>
-
- elki.utilities.optionhandling.parameters.StringParameter
-
- All Implemented Interfaces:
Parameter<java.lang.String>
- Direct Known Subclasses:
DynamicParameters.RemainingOptions
public class StringParameter extends AbstractParameter<StringParameter,java.lang.String>
Parameter class for a parameter specifying a string.- Since:
- 0.3
- Author:
- Steffi Wanka, Erich Schubert
-
-
Field Summary
-
Fields inherited from class elki.utilities.optionhandling.parameters.AbstractParameter
constraints, defaultValue, givenValue, optionalParameter, optionid
-
-
Constructor Summary
Constructors Constructor Description StringParameter(OptionID optionID)
Constructs a string parameter with the given optionID.StringParameter(OptionID optionID, java.lang.String defaultValue)
Constructs a string parameter with the given optionID, and default value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.lang.String> consumer)
Get the parameter.protected java.lang.String
parseValue(java.lang.Object obj)
Parse a given value into the destination type.-
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, validate
-
-
-
-
Constructor Detail
-
StringParameter
public StringParameter(OptionID optionID, java.lang.String defaultValue)
Constructs a string parameter with the given optionID, and default value.- Parameters:
optionID
- the unique id of the parameterdefaultValue
- the default value of the parameter
-
StringParameter
public StringParameter(OptionID optionID)
Constructs a string parameter with the given optionID.- Parameters:
optionID
- the unique id of the 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.lang.String 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<StringParameter,java.lang.String>
- Parameters:
obj
- Object to parse (may be a string representation!)- Returns:
- Parsed object
- Throws:
ParameterException
- when the object cannot be parsed.
-
getSyntax
public java.lang.String getSyntax()
Returns a string representation of the parameter's type.- Returns:
- "<string>"
-
grab
public boolean grab(Parameterization config, java.util.function.Consumer<java.lang.String> consumer)
Get the parameter.- Parameters:
config
- Parameterizationconsumer
- Output consumer- Returns:
true
if valid
-
-