|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.erichseifert.gral.util.Settings
public class Settings
Class that stores a specific and a default setting for a certain key. It provides support for class which register as a listener to listen for setting changes.
SettingsListener
Nested Class Summary | |
---|---|
static class |
Settings.Key
A settings key storing a name. |
Constructor Summary | |
---|---|
Settings(SettingsListener listener)
Creates an empty Settings object. |
Method Summary | ||
---|---|---|
void |
addSettingsListener(SettingsListener l)
Adds a new listener which gets notified if settings have changed. |
|
void |
clearDefaults()
Deletes all default settings. |
|
void |
clearSettings()
Deletes all settings. |
|
|
get(Settings.Key key)
Returns the setting for the specified key. |
|
Map<Settings.Key,Object> |
getDefaults()
Returns a map containing all default settings. |
|
Map<Settings.Key,Object> |
getSettings()
Returns a map containing all settings. |
|
Set<SettingsListener> |
getSettingsListeners()
Returns an unmodifiable set containing all registered listeners. |
|
boolean |
hasDefault(Settings.Key key)
Returns true if there is a default setting for the specified key. |
|
boolean |
hasKey(Settings.Key key)
Returns true if the specified key is contained. |
|
boolean |
hasSetting(Settings.Key key)
Returns true if there is a setting for the specified key. |
|
Set<Settings.Key> |
keySet()
Returns a set containing all keys of this settings object. |
|
|
remove(Settings.Key key)
Removes the setting with the specified key. |
|
|
removeDefault(Settings.Key key)
Removes the default setting with the specified key. |
|
void |
removeSettingsListener(SettingsListener l)
Removes the specified listener. |
|
|
set(Settings.Key key,
T value)
Sets the setting for the specified key. |
|
|
setDefault(Settings.Key key,
T value)
Sets the default setting for the specified key. |
|
Collection<Object> |
values()
Returns a collection containing all settings this object would return. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Settings(SettingsListener listener)
listener
- Initial settings listener.Method Detail |
---|
public void addSettingsListener(SettingsListener l)
l
- listener to be addedpublic void clearDefaults()
public void clearSettings()
public <T> T get(Settings.Key key)
T
- return typekey
- key of the setting
public Map<Settings.Key,Object> getDefaults()
public Map<Settings.Key,Object> getSettings()
public Set<SettingsListener> getSettingsListeners()
public boolean hasDefault(Settings.Key key)
true
if there is a default setting for the specified key.
key
- Key of the setting.
true
if the key has a default setting.public boolean hasSetting(Settings.Key key)
true
if there is a setting for the specified key.
key
- Key of the setting.
true
if the key has a setting.public boolean hasKey(Settings.Key key)
true
if the specified key is contained.
key
- Key to be checked.
true
if the key exists.public Set<Settings.Key> keySet()
public <T> void remove(Settings.Key key)
T
- value typekey
- key of the settingpublic <T> void removeDefault(Settings.Key key)
T
- value typekey
- key of the settingpublic void removeSettingsListener(SettingsListener l)
l
- listener to be removedpublic <T> void set(Settings.Key key, T value)
T
- value typekey
- key of the settingvalue
- value of the settingpublic <T> void setDefault(Settings.Key key, T value)
T
- value typekey
- key of the settingvalue
- default value of the settingpublic Collection<Object> values()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |