Package uk.ac.starlink.ttools.plot2.task
Class ConfigParameter<T>
- java.lang.Object
-
- uk.ac.starlink.task.Parameter<T>
-
- uk.ac.starlink.ttools.plot2.task.ConfigParameter<T>
-
public class ConfigParameter<T> extends uk.ac.starlink.task.Parameter<T>
Typed parameter subclass intended to get the value for a ConfigKey.- Since:
- 1 Mar 2013
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description ConfigParameter(ConfigKey<T> key)
Constructs an un-suffixed config parameter.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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, java.lang.String layerSuffix, boolean hasSuffixDetail)
Returns a layer-indexed config parameter with a given layer suffix.static <T> ConfigParameter<T>
createZoneSuffixedParameter(ConfigKey<T> key, java.lang.String zoneSuffix, boolean hasSuffixDetail)
Returns a zone-indexed config parameter with a given zone suffix.java.lang.String
objectToString(uk.ac.starlink.task.Environment env, T objval)
void
setDefaultOption(T dflt)
Sets the typed default value for this parameter.T
stringToObject(uk.ac.starlink.task.Environment env, java.lang.String stringval)
-
Methods inherited from class uk.ac.starlink.task.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, toString
-
-
-
-
Method Detail
-
stringToObject
public T stringToObject(uk.ac.starlink.task.Environment env, java.lang.String stringval) throws uk.ac.starlink.task.TaskException
- Specified by:
stringToObject
in classuk.ac.starlink.task.Parameter<T>
- Throws:
uk.ac.starlink.task.TaskException
-
objectToString
public java.lang.String objectToString(uk.ac.starlink.task.Environment env, T objval)
- Overrides:
objectToString
in classuk.ac.starlink.task.Parameter<T>
-
setDefaultOption
public void setDefaultOption(T dflt)
Sets the typed default value for this parameter.- Parameters:
dflt
- typed default value
-
createConfigParameter
public static <T> ConfigParameter<T> createConfigParameter(ConfigKey<T> key)
Returns a ConfigParameter based on the given key. I think this factory method is required to invoke the constructor in a typesafe way.- Parameters:
key
- config key- Returns:
- new parameter
-
createLayerSuffixedParameter
public static <T> ConfigParameter<T> createLayerSuffixedParameter(ConfigKey<T> key, java.lang.String layerSuffix, boolean hasSuffixDetail)
Returns a layer-indexed config parameter with a given layer suffix. The name is constructed from the key name followed by the suffix.- Parameters:
key
- config keylayerSuffix
- suffix part of namehasSuffixDetail
- if true, adds additional description about layer suffix usage- Returns:
- new parameter
-
createZoneSuffixedParameter
public static <T> ConfigParameter<T> createZoneSuffixedParameter(ConfigKey<T> key, java.lang.String zoneSuffix, boolean hasSuffixDetail)
Returns a zone-indexed config parameter with a given zone suffix. The name is constructed from the key name followed by the suffix.- Parameters:
key
- config keyzoneSuffix
- suffix part of namehasSuffixDetail
- if true, adds additional description about zone suffix usage- Returns:
- new parameter
-
-