Class Setting

java.lang.Object
net.sourceforge.jnlp.config.Setting

public class Setting extends Object
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.
  • Method Details

    • createDefault

      public static Setting createDefault(String key, String value, ValueValidator validator)
    • createUnknown

      public static Setting createUnknown(String key, String value)
    • createFromPropertyFile

      public static Setting createFromPropertyFile(String key, String value, boolean locked, URL propertyFile)
    • copy

      public Setting copy()
      Creates a copy of this setting
    • getValidator

      public ValueValidator getValidator()
      Returns:
      the ValueValidator that can be used to check if the current value is valid
    • getDefaultValue

      public String getDefaultValue()
      Returns:
      the default value for this setting. May be null if this is not one of the supported settings
    • getDescription

      public String getDescription()
      Returns:
      a human readable description of this setting
    • getName

      public String getName()
      Returns:
      the name (like foo.bar.baz) of this setting
    • getSource

      public String 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

      public String getValue()
      Returns:
      the current value of this setting
    • isLocked

      public boolean isLocked()
      Returns:
      true if this setting is locked
    • setValue

      public void setValue(String 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
      Parameters:
      value - the new value
    • setLocked

      public void setLocked(boolean locked)
    • toString

      public String toString()
      Overrides:
      toString in class Object