Class SwappableDelegatingReference<T>

java.lang.Object
io.deephaven.base.reference.SwappableDelegatingReference<T>
All Implemented Interfaces:
SimpleReference<T>

public class SwappableDelegatingReference<T> extends Object implements SimpleReference<T>
SimpleReference implementation that delegates to an internal SimpleReference which can be replaced using the swapDelegate(SimpleReference, SimpleReference) method.
  • Constructor Details

    • SwappableDelegatingReference

      public SwappableDelegatingReference(@NotNull @NotNull SimpleReference<T> delegate)
  • Method Details

    • swapDelegate

      public void swapDelegate(@NotNull @NotNull SimpleReference<T> oldDelegate, @NotNull @NotNull SimpleReference<T> newDelegate)
      Swap the delegate assigned to this SwappableDelegatingReference.
      Parameters:
      oldDelegate - The delegate to swap out
      newDelegate - The delegate to swap in
      Throws:
      IllegalArgumentException - if oldDelegate is not the current delegate value
    • get

      public T get()
      Description copied from interface: SimpleReference
      Retrieve the current referent.
      Specified by:
      get in interface SimpleReference<T>
      Returns:
      The current referent, which may be null.
    • clear

      public void clear()
      Description copied from interface: SimpleReference
      Clear the referent.
      Specified by:
      clear in interface SimpleReference<T>