Class SettingsBuilder

  • All Implemented Interfaces:
    Settings

    public class SettingsBuilder
    extends java.lang.Object
    implements Settings
    Creates a Settings instance using some setter methods that are handy for unit testing.
    • Constructor Detail

      • SettingsBuilder

        public SettingsBuilder()
        Creates an empty settings.
    • Method Detail

      • 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
      • 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
      • 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
      • 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
      • 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
      • setString

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

        public void setByteArray​(java.lang.String name,
                                 byte[] value)
        Description copied from interface: Settings
        Associates the given byte[] with the name
        Specified by:
        setByteArray in interface Settings
        Parameters:
        name - the key
        value - the value associated with the key
      • setValue

        public void setValue​(java.lang.String name,
                             java.lang.Object value)
        Description copied from interface: Settings
        Associates the given object with the name
        Specified by:
        setValue in interface Settings
        Parameters:
        name - the key
        value - the value to associate with the key
      • clearSetting

        public void clearSetting​(java.lang.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
      • clearAllSettings

        public void clearAllSettings()
        Description copied from interface: Settings
        Removes all name-value pairs from this settings object
        Specified by:
        clearAllSettings in interface Settings
      • 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.
      • 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
      • 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