# 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

## Field Summary

### Fields inherited from class uk.ac.starlink.task.Parameter

`BY_NAME`

## Constructor Summary

Constructors
Constructor
Description
`ConfigParameter(ConfigKey<T> key)`
Constructs an un-suffixed config parameter.

## Method Summary

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, 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(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, 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`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ConfigParameter

public ConfigParameter(ConfigKey<T> key)
Constructs an un-suffixed config parameter.

Parameters:
  `key` - config key

## Method Details

### stringToObject

public T stringToObject(uk.ac.starlink.task.Environment env, String stringval) throws uk.ac.starlink.task.TaskException

Specified by:
  `stringToObject` in class `uk.ac.starlink.task.Parameter<T>`
Throws:
  `uk.ac.starlink.task.TaskException`

### objectToString

public String objectToString(uk.ac.starlink.task.Environment env, T objval)

Overrides:
  `objectToString` in class `uk.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, 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 key
  `layerSuffix` - suffix part of name
  `hasSuffixDetail` - if true, adds additional description about layer suffix usage
Returns:
  new parameter

### createZoneSuffixedParameter

public static <T> ConfigParameter<T> createZoneSuffixedParameter(ConfigKey<T> key, 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 key
  `zoneSuffix` - suffix part of name
  `hasSuffixDetail` - if true, adds additional description about zone suffix usage
Returns:
  new parameter