Class SettingsImpl

  • All Implemented Interfaces:
    Settings, java.io.Serializable

    public class SettingsImpl
    extends java.lang.Object
    implements Settings, java.io.Serializable
    Basic implementation of the Settings object
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SettingsImpl()
      Construct a new SettingsImpl
      SettingsImpl​(Settings settings)
      Construct a new SettingsImpl object with the same set of name-value pairs as the given settings object
      SettingsImpl​(javax.swing.event.ChangeListener listener, java.lang.Object changeSourceObj)
      Construct a new SettingsImpl with the given listener
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearAllSettings()
      Removes all name-value pairs from this settings object
      void clearSetting​(java.lang.String name)
      Removes any value associated with the given name
      byte[] getByteArray​(java.lang.String name)
      Gets the byte[] value associated with the given name
      Settings getDefaultSettings()
      Returns the underlying default settings for these settings or null if there are none
      java.lang.Long getLong​(java.lang.String name)
      Gets the Long value associated with the given name
      java.lang.String[] getNames()
      Get this list of keys that currently have values associated with them
      java.lang.String getString​(java.lang.String name)
      Gets the String value associated with the given name
      java.lang.Object getValue​(java.lang.String name)
      Gets the object associated with the given name
      boolean isEmpty()
      Returns true if there are no key-value pairs stored in this settings object
      void setByteArray​(java.lang.String name, byte[] value)
      Associates the given byte[] with the name
      void setDefaultSettings​(Settings settings)  
      void setLong​(java.lang.String name, long value)
      Associates the given long value with the name
      void setString​(java.lang.String name, java.lang.String value)
      Associates the given String value with the name
      void setValue​(java.lang.String name, java.lang.Object value)
      Associates the given object with the name
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NO_SETTINGS

        public static final Settings NO_SETTINGS
    • Constructor Detail

      • SettingsImpl

        public SettingsImpl()
        Construct a new SettingsImpl
      • SettingsImpl

        public SettingsImpl​(javax.swing.event.ChangeListener listener,
                            java.lang.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
      • SettingsImpl

        public SettingsImpl​(Settings settings)
        Construct a new SettingsImpl object with the same set of name-value pairs as the given settings object
        Parameters:
        settings - the settings object to copy
    • Method Detail

      • toString

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

        public boolean isEmpty()
        Description copied from interface: Settings
        Returns true if there are no key-value pairs stored in this settings object
        Specified by:
        isEmpty in interface Settings
        See Also:
        Settings.isEmpty()
      • getLong

        public java.lang.Long getLong​(java.lang.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
        See Also:
        Settings.getLong(java.lang.String)
      • getString

        public java.lang.String getString​(java.lang.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
        See Also:
        Settings.getString(java.lang.String)
      • getByteArray

        public byte[] getByteArray​(java.lang.String name)
        Description copied from interface: Settings
        Gets the byte[] value associated with the given name
        Specified by:
        getByteArray in interface Settings
        Parameters:
        name - the key used to retrieve a value
        Returns:
        the byte[] value for a key
        See Also:
        Settings.getByteArray(java.lang.String)
      • setLong

        public void setLong​(java.lang.String name,
                            long value)
        Description copied from interface: Settings
        Associates the given long value with the name
        Specified by:
        setLong in interface Settings
        Parameters:
        name - the key
        value - the value associated with the key
        See Also:
        Settings.setLong(java.lang.String, long)
      • getNames

        public java.lang.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.
        See Also:
        Settings.getNames()
      • getValue

        public java.lang.Object getValue​(java.lang.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
        See Also:
        Settings.getValue(java.lang.String)
      • setDefaultSettings

        public void setDefaultSettings​(Settings settings)