Interface Settings

All Known Subinterfaces:
Data
All Known Implementing Classes:
DataStub, PseudoData, SettingsImpl

public interface Settings
Settings objects store name-value pairs. Each SettingsDefinition defines one or more names to use to store values in settings objects. Exactly what type of value and how to interpret the value is done by the SettingsDefinition object.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String[]
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes all name-value pairs from this settings object
    void
    Removes any value associated with the given name
    Returns the underlying default settings for these settings or null if there are none
    Gets the Long value associated with the given name
    Get this list of keys that currently have values associated with them
    Gets the String value associated with the given name
    default String[]
    Get an array of suggested values for the specified string settings definition.
    Gets the object associated with the given name
    boolean
    isChangeAllowed(SettingsDefinition settingsDefinition)
    Determine if a settings change corresponding to the specified settingsDefinition is permitted.
    boolean
    Returns true if there are no key-value pairs stored in this settings object.
    void
    setLong(String name, long value)
    Associates the given long value with the name.
    void
    setString(String name, String value)
    Associates the given String value with the name.
    void
    setValue(String name, Object value)
    Associates the given object with the name.
  • Field Details

    • EMPTY_STRING_ARRAY

      static final String[] EMPTY_STRING_ARRAY
  • Method Details

    • isChangeAllowed

      boolean isChangeAllowed(SettingsDefinition settingsDefinition)
      Determine if a settings change corresponding to the specified settingsDefinition is permitted.
      Parameters:
      settingsDefinition - settings definition
      Returns:
      true if change permitted else false
    • getSuggestedValues

      default String[] getSuggestedValues(StringSettingsDefinition settingsDefinition)
      Get an array of suggested values for the specified string settings definition.
      Parameters:
      settingsDefinition - string settings definition
      Returns:
      suggested values array (may be empty)
    • getLong

      Long getLong(String name)
      Gets the Long value associated with the given name
      Parameters:
      name - the key used to retrieve a value
      Returns:
      the Long value for a key
    • getString

      String getString(String name)
      Gets the String value associated with the given name
      Parameters:
      name - the key used to retrieve a value
      Returns:
      the String value for a key
    • getValue

      Object getValue(String name)
      Gets the object associated with the given name
      Parameters:
      name - the key used to retrieve a value
      Returns:
      the object associated with a given key
    • setLong

      void setLong(String name, long value)
      Associates the given long value with the name. Note that an attempted setting change may be ignored if prohibited (e.g., immutable Settings, undefined setting name).
      Parameters:
      name - the key
      value - the value associated with the key
    • setString

      void setString(String name, String value)
      Associates the given String value with the name. Note that an attempted setting change may be ignored if prohibited (e.g., immutable Settings, undefined setting name).
      Parameters:
      name - the key
      value - the value associated with the key
    • setValue

      void setValue(String name, Object value)
      Associates the given object with the name. Note that an attempted setting change may be ignored if prohibited (e.g., immutable Settings, undefined setting name).
      Parameters:
      name - the key
      value - the value to associate with the key
    • clearSetting

      void clearSetting(String name)
      Removes any value associated with the given name
      Parameters:
      name - the key to remove any association
    • clearAllSettings

      void clearAllSettings()
      Removes all name-value pairs from this settings object
    • getNames

      String[] getNames()
      Get this list of keys that currently have values associated with them
      Returns:
      an array of string keys.
    • isEmpty

      boolean isEmpty()
      Returns true if there are no key-value pairs stored in this settings object. This is not a reflection of the underlying default settings which may still contain a key-value pair when this settings object is empty.
      Returns:
      true if there are no key-value pairs stored in this settings object
    • getDefaultSettings

      Settings getDefaultSettings()
      Returns the underlying default settings for these settings or null if there are none
      Returns:
      underlying default settings or null