Class WeakCopyFunctionSupport<T>

All Implemented Interfaces:
Changeable<T>, ChangingSource<T>, BoundFunction<T,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.
Author:
Fabrizio Giudici
  • Field Details

    • targetValue

      @Nonnull protected T targetValue
  • Constructor Details

    • WeakCopyFunctionSupport

      public WeakCopyFunctionSupport(@Nonnull ChangingSource<T> source)
  • Method Details

    • onSourceChange

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

      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

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

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