Package org.moeaframework.util.mvc
Class Setting<T>
java.lang.Object
org.moeaframework.util.mvc.Setting<T>
- Type Parameters:
T
- the underlying type of the setting
- Direct Known Subclasses:
Toggle
Setting that can fire events when the value changes.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Registers a listener to be notified when this setting value changes.get()
Gets the value.Returns the default value for this setting.void
Removes a listener so it is no longer notified of changes.void
Sets the value.
-
Constructor Details
-
Setting
Constructs a setting with the default value.- Parameters:
defaultValue
- the default value
-
-
Method Details
-
getDefaultValue
Returns the default value for this setting.- Returns:
- the default value
-
set
Sets the value. Any registered listeners are notified if the value changes.- Parameters:
newValue
- the new value
-
get
Gets the value. If no value has been set, returns the default value.- Returns:
- the value
-
addSettingChangedListener
Registers a listener to be notified when this setting value changes.- Parameters:
listener
- the listener to add
-
removeSettingChangedListener
Removes a listener so it is no longer notified of changes.- Parameters:
listener
- the listener to remove
-