public abstract class ChoiceConfigKey<T> extends ConfigKey<T>
| Constructor and Description |
|---|
ChoiceConfigKey(ConfigMeta meta,
Class<T> clazz,
T dflt,
boolean nullPermitted)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOption(T option)
Adds an option to the permitted list.
|
abstract T |
decodeString(String sval)
Takes a string, and attempts to turn it into an object which may
be a value for this key.
|
Map<String,T> |
getOptionMap()
Returns a mutable map giving the currently available known options
and their string values.
|
abstract String |
stringifyValue(T value)
Takes an object which may be a value of this key,
and attempts to turn it into a string for reporting purposes.
|
T |
stringToValue(String sval)
Decodes a string value to the value type of this key.
|
String |
valueToString(T value)
Reports a value as a string.
|
cast, createSpecifier, getDefaultValue, getMeta, getValueClass, toStringpublic ChoiceConfigKey(ConfigMeta meta, Class<T> clazz, T dflt, boolean nullPermitted)
meta - metadataclazz - value classdflt - default valuenullPermitted - true iff null is a permitted valuepublic void addOption(T option)
stringifyValue(T) method,
which must return a non-null value.
For more flexibility, you can manipulate the return value of
getOptionMap() directly.
option - option to addpublic Map<String,T> getOptionMap()
public abstract T decodeString(String sval)
This method should be the opposite of stringifyValue(T),
but does not need to be consistent with
stringToValue or
valueToString.
sval - string representationpublic abstract String stringifyValue(T value)
This method should if possible
be the opposite of decodeString(java.lang.String),
but does not need to be consistent with
stringToValue or
valueToString.
If no round-trippable value is available, null should be returned.
value - typed objectpublic T stringToValue(String sval) throws ConfigException
ConfigKeystringToValue in class ConfigKey<T>sval - string representation of valueConfigExceptionpublic String valueToString(T value)
ConfigKeystringToValue(valueToString(v)).equals(v).
A null value, if permitted, should be represented as an empty string.valueToString in class ConfigKey<T>value - possible value associated with this keyCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.