public class ConfigParameter<T> extends Parameter<T>
| Constructor and Description |
|---|
ConfigParameter(ConfigKey<T> key)
Constructs an un-suffixed config parameter.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> ConfigParameter<T> |
createConfigParameter(ConfigKey<T> key)
Returns a ConfigParameter based on the given key.
|
static <T> ConfigParameter<T> |
createLayerSuffixedParameter(ConfigKey<T> key,
String layerSuffix,
boolean hasSuffixDetail)
Returns a layer-indexed config parameter with a given layer suffix.
|
static <T> ConfigParameter<T> |
createZoneSuffixedParameter(ConfigKey<T> key,
String zoneSuffix,
boolean hasSuffixDetail)
Returns a zone-indexed config parameter with a given zone suffix.
|
String |
objectToString(Environment env,
T objval)
Takes a typed value of this parameter and formats it as a string
which may be used for presentation to the user.
|
void |
setDefaultOption(T dflt)
Sets the typed default value for this parameter.
|
T |
stringToObject(Environment env,
String stringval)
Takes a non-blank string, as supplied by the execution environment,
and turns it into a typed value for this parameter.
|
clearValue, getDescription, getName, getPosition, getPreferExplicit, getPrompt, getStringDefault, getUsage, getValueClass, isNullPermitted, objectValue, setDescription, setDescription, setName, setNullPermitted, setPosition, setPreferExplicit, setPrompt, setStringDefault, setUsage, setValue, setValueFromObject, setValueFromString, stringValue, toArray, toStringpublic T stringToObject(Environment env, String stringval) throws TaskException
ParameterIt is an error to supply a null or empty string value.
If this method fails (throws a ParameterValueException)
and if allowClassnameValue is set, then a subsequent
attempt will be made to interpret the stringVal
as the classname of a suitable class with a no-arg constructor.
stringToObject in class Parameter<T>env - execution environment; in most cases this is not required
but for some purposes environment-specific characteristics
may influence the resultstringval - non-null, non-empty string valueTaskExceptionpublic String objectToString(Environment env, T objval)
ParameterstringToObject should be possible,
but that is not in general required/guaranteed.
The default implementation uses the value's toString method, but subclasses can override this for smarter behaviour.
objectToString in class Parameter<T>env - execution environmentobjval - typed parameter valuepublic void setDefaultOption(T dflt)
dflt - typed default valuepublic static <T> ConfigParameter<T> createConfigParameter(ConfigKey<T> key)
key - config keypublic static <T> ConfigParameter<T> createLayerSuffixedParameter(ConfigKey<T> key, String layerSuffix, boolean hasSuffixDetail)
key - config keylayerSuffix - suffix part of namehasSuffixDetail - if true, adds additional description about
layer suffix usagepublic static <T> ConfigParameter<T> createZoneSuffixedParameter(ConfigKey<T> key, String zoneSuffix, boolean hasSuffixDetail)
key - config keyzoneSuffix - suffix part of namehasSuffixDetail - if true, adds additional description about
zone suffix usageCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.