public class StringSetting extends AbstractSetting<java.lang.String>
StringSetting
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 StringSetting
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 StringSetting
s with
the same name should be identical.
StringSetting
s 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 StringSetting
may be queried a large number of times in the same request.
Constructor and Description |
---|
StringSetting(java.lang.String name,
java.lang.String description,
java.lang.String... options) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
find(java.lang.String o)
Find the required object.
|
protected java.lang.String |
getConfigValue(AppContext conn) |
java.lang.String |
getCurrent(AppContext conn)
get the current value of the setting
|
java.lang.String |
getIndex(java.lang.String value)
Get the underlying data representation corresponding to the value
|
ItemInput<java.lang.String,java.lang.String> |
getInput(AppContext conn)
and
Input to select the setting |
protected java.lang.String |
getTag() |
java.lang.Class<java.lang.String> |
getTarget()
Get the type of the returned object as far as it is known.
|
java.lang.String |
getText(java.lang.String b) |
equals, findFeatureByName, getDefault, getDescription, getFeatureTable, getKnownFeatures, getName, hashCode, toString
public StringSetting(java.lang.String name, java.lang.String description, java.lang.String... options)
public java.lang.String getCurrent(AppContext conn)
Setting
conn
- AppContextprotected java.lang.String getConfigValue(AppContext conn)
protected java.lang.String getTag()
public ItemInput<java.lang.String,java.lang.String> getInput(AppContext conn)
Setting
Input
to select the settingpublic java.lang.String getText(java.lang.String b)
getText
in class AbstractSetting<java.lang.String>
public java.lang.String find(java.lang.String o)
TypeConverter
o
- Value of the database fieldpublic java.lang.String getIndex(java.lang.String value)
TypeConverter
public java.lang.Class<java.lang.String> getTarget()
Targetted