public class Setting<T>
extends java.lang.Object
Constructor and Description |
---|
Setting(Setting<T> other)
Creates a new Settings object by cloning the values from another
Settings object
|
Setting(java.lang.String name,
java.lang.String description,
boolean locked,
ValueValidator validator,
T defaultValue,
T value,
java.lang.String source)
Creates a new Settings object
|
Modifier and Type | Method and Description |
---|---|
T |
getDefaultValue() |
java.lang.String |
getDescription() |
java.lang.String |
getName() |
java.lang.String |
getSource() |
ValueValidator |
getValidator() |
T |
getValue() |
boolean |
isLocked() |
void |
setLocked(boolean locked)
Marks this setting as locked or unlocked.
|
void |
setSource(java.lang.String source)
Sets the source of the current value of this Setting.
|
void |
setValue(T value)
Note that setting the value is not enforced - it is the caller's
responsibility to check if a value is locked or not before setting a
new value
|
java.lang.String |
toString() |
public Setting(java.lang.String name, java.lang.String description, boolean locked, ValueValidator validator, T defaultValue, T value, java.lang.String source)
name
- the name of this settingdescription
- a human readable description of this settinglocked
- whether this setting is currently lockedvalidator
- the ValueValidator
that can be used to validate
the valuedefaultValue
- the default value of this setting. If this is not a
recognized setting, use null.value
- the initial value of this settingsource
- the origin of the value (a file, or perhaps "<internal>
")public ValueValidator getValidator()
ValueValidator
that can be used to check if
the current value is validpublic T getDefaultValue()
public java.lang.String getDescription()
public java.lang.String getName()
public java.lang.String getSource()
public T getValue()
public boolean isLocked()
public void setLocked(boolean locked)
locked
- whether to mark this setting as locked or not locked.public void setSource(java.lang.String source)
source
- the source of the valuepublic void setValue(T value)
value
- the new valuepublic java.lang.String toString()
toString
in class java.lang.Object