Class WeakCopyFunctionSupport<T>

All Implemented Interfaces:
ChangingSource<T>, BoundFunction<T,T>, Mutable, Changeable<T>
Direct Known Subclasses:
CopyIfEmptyOrConform

public abstract class WeakCopyFunctionSupport<T> extends UnaryBoundFunctionSupport<T,T> implements Changeable<T>
Changes the destination only at a certain condition in function of the target.
Since:
2.0-ALPHA-1
Author:
Fabrizio Giudici
  • Field Details Link icon

    • targetValue Link icon

      @Nonnull protected T targetValue
  • Constructor Details Link icon

    • WeakCopyFunctionSupport Link icon

      protected WeakCopyFunctionSupport(@Nonnull ChangingSource<T> source)
  • Method Details Link icon

    • onSourceChange Link icon

      protected void onSourceChange(@Nonnull T oldSourceValue, @Nonnull T newSourceValue)
      Overrides:
      onSourceChange in class UnaryBoundFunctionSupport<T,T>
    • set Link icon

      public void set(T value)
      Description copied from interface: Changeable
      Sets a new value to this object.
      Specified by:
      set in interface Changeable<T>
      Parameters:
      value - the new value
    • shouldChange Link icon

      protected abstract boolean shouldChange(T oldValue, T newValue)
    • function Link icon

      @Nonnull protected T function(@Nonnull T value)
      Specified by:
      function in class UnaryBoundFunctionSupport<T,T>