Class SettingsImpl

java.lang.Object
ghidra.docking.settings.SettingsImpl
All Implemented Interfaces:
Settings, Serializable

public class SettingsImpl extends Object implements Settings, Serializable
Basic implementation of the Settings object
See Also:
  • Field Details

    • NO_SETTINGS

      public static final Settings NO_SETTINGS
  • Constructor Details

    • SettingsImpl

      public SettingsImpl()
      Construct a new SettingsImpl.
    • SettingsImpl

      public SettingsImpl(Predicate<String> allowedSettingPredicate)
      Construct a new SettingsImpl with a modification predicate.
      Parameters:
      allowedSettingPredicate - callback for checking an allowed setting modification
    • SettingsImpl

      public SettingsImpl(Settings settings)
      Construct a new SettingsImpl object. If settings object is specified this settings will copy all name/value pairs and underlying defaults.
      Parameters:
      settings - the settings object to copy
    • SettingsImpl

      public SettingsImpl(boolean immutable)
      Construct a new SettingsImpl.
      Parameters:
      immutable - if true settings are immutable with the exception of setting its default settings. If false settings may be modified.
    • SettingsImpl

      public SettingsImpl(ChangeListener listener, Object changeSourceObj)
      Construct a new SettingsImpl with the given listener
      Parameters:
      listener - object to be notified as settings values change
      changeSourceObj - source object to be associated with change events
  • Method Details

    • isChangeAllowed

      public boolean isChangeAllowed(SettingsDefinition settingsDefinition)
      Description copied from interface: Settings
      Determine if a settings change corresponding to the specified settingsDefinition is permitted.
      Specified by:
      isChangeAllowed in interface Settings
      Parameters:
      settingsDefinition - settings definition
      Returns:
      true if change permitted else false
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Settings
      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.
      Specified by:
      isEmpty in interface Settings
      Returns:
      true if there are no key-value pairs stored in this settings object
    • getLong

      public Long getLong(String name)
      Description copied from interface: Settings
      Gets the Long value associated with the given name
      Specified by:
      getLong in interface Settings
      Parameters:
      name - the key used to retrieve a value
      Returns:
      the Long value for a key
    • getString

      public String getString(String name)
      Description copied from interface: Settings
      Gets the String value associated with the given name
      Specified by:
      getString in interface Settings
      Parameters:
      name - the key used to retrieve a value
      Returns:
      the String value for a key
    • setLong

      public void setLong(String name, long value)
      Description copied from interface: Settings
      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).
      Specified by:
      setLong in interface Settings
      Parameters:
      name - the key
      value - the value associated with the key
    • setString

      public void setString(String name, String value)
      Description copied from interface: Settings
      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).
      Specified by:
      setString in interface Settings
      Parameters:
      name - the key
      value - the value associated with the key
    • clearSetting

      public void clearSetting(String name)
      Description copied from interface: Settings
      Removes any value associated with the given name
      Specified by:
      clearSetting in interface Settings
      Parameters:
      name - the key to remove any association
    • getNames

      public String[] getNames()
      Description copied from interface: Settings
      Get this list of keys that currently have values associated with them
      Specified by:
      getNames in interface Settings
      Returns:
      an array of string keys.
    • getValue

      public Object getValue(String name)
      Description copied from interface: Settings
      Gets the object associated with the given name
      Specified by:
      getValue in interface Settings
      Parameters:
      name - the key used to retrieve a value
      Returns:
      the object associated with a given key
    • setValue

      public void setValue(String name, Object value)
      Description copied from interface: Settings
      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).
      Specified by:
      setValue in interface Settings
      Parameters:
      name - the key
      value - the value to associate with the key
    • clearAllSettings

      public void clearAllSettings()
      Description copied from interface: Settings
      Removes all name-value pairs from this settings object
      Specified by:
      clearAllSettings in interface Settings
    • setDefaultSettings

      public void setDefaultSettings(Settings settings)
    • getDefaultSettings

      public Settings getDefaultSettings()
      Description copied from interface: Settings
      Returns the underlying default settings for these settings or null if there are none
      Specified by:
      getDefaultSettings in interface Settings
      Returns:
      underlying default settings or null