Interface AbstractScopedSettings.SettingUpdater<T>
- Type Parameters:
T
- the type of the value of the setting
- Enclosing class:
- AbstractScopedSettings
public static interface AbstractScopedSettings.SettingUpdater<T>
Transactional interface to update settings.
- See Also:
Setting
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Updates this updaters value if it has changed.void
Applies the given value to the updater.Returns the instance value for the current settings.boolean
hasChanged(Settings current, Settings previous)
Returns true if this updaters setting has changed with the current updatedefault Runnable
Returns a callable runnable that callsapply(Object, Settings, Settings)
if the settings actually changed.
-
Method Details
-
hasChanged
Returns true if this updaters setting has changed with the current update- Parameters:
current
- the current settingsprevious
- the previous setting- Returns:
- true if this updaters setting has changed with the current update
-
getValue
Returns the instance value for the current settings. This method is stateless and idempotent. This method will throw an exception if the source of this value is invalid. -
apply
Applies the given value to the updater. This methods will actually run the update. -
apply
Updates this updaters value if it has changed.- Returns:
true
iff the value has been updated.
-
updater
Returns a callable runnable that callsapply(Object, Settings, Settings)
if the settings actually changed. This allows to defer the update to a later point in time while keeping type safety. If the value didn't change the returned runnable is a noop.
-