Interface Parameter<T>
- Type Parameters:
T
- the type of the parameter
- All Superinterfaces:
Named
- All Known Subinterfaces:
EnumeratedParameter<T>
,NumericParameter<T>
,SampledParameter<T>
- All Known Implementing Classes:
AbstractParameter
,Constant
,Enumeration
,SampledDouble
,SampledInteger
,SampledLong
Represents a typed parameter.
To support saving and loading parameters from a file, all parameters must implement the encode(Tokenizer)
method along with a static decode(Tokenizer, String)
method.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
assignValue
(TypedProperties sample, T value) Assigns the parameter value in the given sample.static Parameter<?>
Decodes the string representation of a parameter.static Parameter<?>
Decodes the string representation of a parameter.Encodes this parameter definition in a format suitable for storing in a file.static ParameterBuilder
Entry point to using the parameter builder.Parses this parameter value from the given string.default T
readValue
(TypedProperties sample) Reads the parameter value from the given sample.
-
Method Details
-
parse
Parses this parameter value from the given string.- Parameters:
str
- the string- Returns:
- the parameter value
- Throws:
InvalidParameterException
- if the given string is not a valid parameter value
-
encode
Encodes this parameter definition in a format suitable for storing in a file.- Parameters:
tokenizer
- the tokenizer- Returns:
- the string representation
-
readValue
Reads the parameter value from the given sample.- Parameters:
sample
- the sample- Returns:
- the parameter value
-
assignValue
Assigns the parameter value in the given sample.- Parameters:
sample
- the samplevalue
- the value to assign
-
named
Entry point to using the parameter builder. This starts by specifying the name, with additional options being configured on the returned builder.- Parameters:
name
- the parameter name- Returns:
- the parameter builder
-
decode
Decodes the string representation of a parameter.- Parameters:
line
- the string representation- Returns:
- the decoded parameter
- Throws:
InvalidParameterException
- if the string representation is not a valid parameter
-
decode
Decodes the string representation of a parameter.- Parameters:
tokenizer
- the tokenizerline
- the string representation- Returns:
- the decoded parameter
- Throws:
InvalidParameterException
- if the string representation is not a valid parameter
-