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 | Description |
---|---|
ToggleNullConfigKey(ConfigKey<T> baseKey,
java.lang.String toggleLabel,
boolean toggleDflt) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
Specifier<T> |
createSpecifier() |
Constructs a graphical control with which the user can
specify a suitable value for association with this key.
|
T |
stringToValue(java.lang.String txt) |
Decodes a string value to the value type of this key.
|
java.lang.String |
valueToString(T value) |
Reports a value as a string.
|
cast, getDefaultValue, getMeta, getValueClass, toString
public ToggleNullConfigKey(ConfigKey<T> baseKey, java.lang.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 java.lang.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(java.lang.String txt) throws ConfigException
ConfigKey
stringToValue
in class ConfigKey<T>
txt
- string representation of valueConfigException
Copyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.