org.gjt.rec.util
Interface Settings

All Known Implementing Classes:
AbstractSettings, ResourceSettings

public interface Settings

Settings is a shorter word for Properties. It's also an an interface, which is different from Properties. It also adds support for setting change notification.

Author:
Neil Stockbridge

Field Summary
static String REVISION
           
 
Method Summary
 void addSettingsListener(SettingsListener listener)
          Registers a listener with this settings object so that it receives notification when this settings object changes.
 Object get(String name)
          Looks up the value of a setting.
 Iterator getNames()
          Returns an Iterator over the names of each setting in this settings object.
 void remove(String name)
          Removes a setting.
 void removeSettingsListener(SettingsListener listener)
          Removes a listener from the list of objects that are notified when this settings object changes.
 void set(String name, Object value)
          Sets the value of a setting.
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values
Method Detail

getNames

public Iterator getNames()
Returns an Iterator over the names of each setting in this settings object.


get

public Object get(String name)
Looks up the value of a setting.

Parameters:
name - the name of the setting to look up
Returns:
the value of the named setting or null if there was no setting by the that name.
Throws:
IllegalArgumentException - if the supplied setting name is null

set

public void set(String name,
                Object value)
Sets the value of a setting.

Parameters:
name - the name of the setting to set the value of
value - the (new) value of the setting
Throws:
IllegalArgumentException - if either of the supplied arguments are null
UnsupportedOperationException - if settings cannot be set on this settings object.

remove

public void remove(String name)
Removes a setting.

Parameters:
name - the name of the setting to remove
Throws:
IllegalArgumentException - if the supplied setting name is null
UnsupportedOperationException - if settings cannot be removed from this settings object.

addSettingsListener

public void addSettingsListener(SettingsListener listener)
Registers a listener with this settings object so that it receives notification when this settings object changes.

Parameters:
listener - the listener to register
Throws:
IllegalArgumentException - if the specified listener is null

removeSettingsListener

public void removeSettingsListener(SettingsListener listener)
Removes a listener from the list of objects that are notified when this settings object changes. If the listener is registered multiply, only the last registered reference will be removed.

Parameters:
listener - the listener to unregister
Throws:
IllegalArgumentException - if the specified listener is null or if it was not null but was not previously registered as a listener with this settings object.