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:
  • Method Details

    • hasChanged

      boolean hasChanged(Settings current, Settings previous)
      Returns true if this updaters setting has changed with the current update
      Parameters:
      current - the current settings
      previous - the previous setting
      Returns:
      true if this updaters setting has changed with the current update
    • getValue

      T getValue(Settings current, Settings previous)
      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

      void apply(T value, Settings current, Settings previous)
      Applies the given value to the updater. This methods will actually run the update.
    • apply

      default boolean apply(Settings current, Settings previous)
      Updates this updaters value if it has changed.
      Returns:
      true iff the value has been updated.
    • updater

      default Runnable updater(Settings current, Settings previous)
      Returns a callable runnable that calls apply(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.