Package org.opensearch.common.settings
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 Type Method Description default boolean
apply(Settings current, Settings previous)
Updates this updaters value if it has changed.void
apply(T value, Settings current, Settings previous)
Applies the given value to the updater.T
getValue(Settings current, Settings previous)
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 java.lang.Runnable
updater(Settings current, Settings previous)
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.
-