public class ToggleNullConfigKey<T> extends ConfigKey<T>
This is intended for use with config keys that do not normally accept null values. If used with config keys that do permit null values, confusion may result.
Constructor and Description |
---|
ToggleNullConfigKey(ConfigKey<T> baseKey,
String toggleLabel,
boolean toggleDflt)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Specifier<T> |
createSpecifier()
Constructs a graphical control with which the user can
specify a suitable value for association with this key.
|
T |
stringToValue(String txt)
Decodes a string value to the value type of this key.
|
String |
valueToString(T value)
Reports a value as a string.
|
cast, getDefaultValue, getMeta, getValueClass, toString
public ToggleNullConfigKey(ConfigKey<T> baseKey, String toggleLabel, boolean toggleDflt)
baseKey
- config key providing non-null-valued behaviourtoggleLabel
- GUI label for the toggle button selecting nulltoggleDflt
- true if the default is null,
false if the default is that of the base keypublic String valueToString(T value)
ConfigKey
stringToValue(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 keypublic T stringToValue(String txt) throws ConfigException
ConfigKey
stringToValue
in class ConfigKey<T>
txt
- string representation of valueConfigException
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.