public class EnumSetting<E extends java.lang.Enum> extends AbstractSetting<E>
EnumSetting represents optional feature in the code.
Normally this should be encapsulated as a singleton constant field so we can
locate them by reflection and generate on-line documentation.
Each EnumSetting object defines a name for the feature a default setting and descriptive documentation.
Some legacy features may be generated dynamically so the same feature may be constructed multiple times but EnumSettings with
the same name should be identical.
EnumSettings can be turned on and off using configuration parameters
e.g. service.feature.feature-name=true
The results are also cached in the AppContext as the same EnumSetting may be queried a large number of times in the same request.
| Constructor and Description |
|---|
EnumSetting(java.lang.Class<E> clazz,
java.lang.String name,
E def,
java.lang.String description) |
| Modifier and Type | Method and Description |
|---|---|
E |
find(java.lang.String o)
Find the required object.
|
protected E |
getConfigValue(AppContext conn) |
E |
getCurrent(AppContext conn)
get the current value of the setting
|
java.lang.String |
getIndex(E value)
Get the underlying data representation corresponding to the value
|
ItemInput<java.lang.String,E> |
getInput(AppContext conn)
and
Input to select the setting |
protected java.lang.String |
getTag() |
java.lang.Class<E> |
getTarget()
Get the type of the returned object as far as it is known.
|
java.lang.String |
getText(E b) |
equals, findFeatureByName, getDefault, getDescription, getFeatureTable, getKnownFeatures, getName, hashCode, toStringprotected final java.lang.Class<E extends java.lang.Enum> clazz
public E getCurrent(AppContext conn)
Settingconn - AppContextprotected E getConfigValue(AppContext conn)
protected java.lang.String getTag()
public ItemInput<java.lang.String,E> getInput(AppContext conn)
SettingInput to select the settingpublic java.lang.String getText(E b)
getText in class AbstractSetting<E extends java.lang.Enum>public E find(java.lang.String o)
TypeConvertero - Value of the database fieldpublic java.lang.String getIndex(E value)
TypeConverter