Package io.deephaven.base.reference
Class SwappableDelegatingReference<T>
java.lang.Object
io.deephaven.base.reference.SwappableDelegatingReference<T>
- All Implemented Interfaces:
SimpleReference<T>
SimpleReference
implementation that delegates to an internal SimpleReference
which can be replaced
using the swapDelegate(SimpleReference, SimpleReference)
method.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the referent.get()
Retrieve the current referent.void
swapDelegate
(@NotNull SimpleReference<T> oldDelegate, @NotNull SimpleReference<T> newDelegate) Swap the delegate assigned to this SwappableDelegatingReference.
-
Constructor Details
-
SwappableDelegatingReference
-
-
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 outnewDelegate
- The delegate to swap in- Throws:
IllegalArgumentException
- ifoldDelegate
is not the current delegate value
-
get
Description copied from interface:SimpleReference
Retrieve the current referent.- Specified by:
get
in interfaceSimpleReference<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 interfaceSimpleReference<T>
-