Class Setting
java.lang.Object
net.sourceforge.jnlp.config.Setting
Represents a value for a configuration. Provides methods to get the value
as well as marking the value as locked.
Each instance of this class has an associated ValueChecker. This checker
can be used to check if the current value is valid. The default value
_must_ be valid. Null values can not originate externally so are (mostly)
considered valid.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Creates a copy of this setting(package private) SettingcopyValuesFrom(Setting src) Creates a copy of this setting and copies the following attributes fromsrc: - value - locked - sourcestatic SettingcreateDefault(String key, String value, ValueValidator validator) static SettingcreateFromPropertyFile(String key, String value, boolean locked, URL propertyFile) static SettingcreateUnknown(String key, String value) getName()getValue()booleanisLocked()voidsetLocked(boolean locked) voidNote 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 valuetoString()
-
Field Details
-
name
-
description
-
validator
-
source
-
defaultValue
-
value
-
locked
private boolean locked
-
-
Constructor Details
-
Setting
private Setting(String name, String description, boolean locked, ValueValidator validator, String defaultValue, String value, String source) Creates a new Settings object- Parameters:
name- the name of this settingdescription- a human readable description of this settinglocked- whether this setting is currently lockedvalidator- theValueValidatorthat 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>")
-
-
Method Details
-
createDefault
-
createUnknown
-
createFromPropertyFile
-
copy
Creates a copy of this setting -
copyValuesFrom
-
getValidator
- Returns:
- the
ValueValidatorthat can be used to check if the current value is valid
-
getDefaultValue
- Returns:
- the default value for this setting. May be null if this is not one of the supported settings
-
getDescription
- Returns:
- a human readable description of this setting
-
getName
- Returns:
- the name (like foo.bar.baz) of this setting
-
getSource
- Returns:
- the source of the current value of this setting. May be a string like "internal" or it may be the location of the properties file
-
getValue
- Returns:
- the current value of this setting
-
isLocked
public boolean isLocked()- Returns:
- true if this setting is locked
-
setValue
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- Parameters:
value- the new value
-
setLocked
public void setLocked(boolean locked) -
toString
-