Package org.apache.calcite.util
Class LazyReference<T>
java.lang.Object
org.apache.calcite.util.LazyReference<T>
- Type Parameters:
- T- Element Type
This class can is able to do a lazy initiaization
 of an object based on a 
Supplier.
 In contrast to Suppliers.memoize, the supplier is passed
 at the later point in time, during the call to getOrCompute.
 This allows the usage in abstract base classes with a supplier
 method, implemented in a derived class.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiongetOrCompute(Supplier<T> supplier) Atomically sets the value tosupplier.get()if the current value was not set yet.voidreset()Resets the current value.
- 
Constructor Details- 
LazyReferencepublic LazyReference()
 
- 
- 
Method Details- 
getOrComputeAtomically sets the value tosupplier.get()if the current value was not set yet.This method is reentrant. Different threads will get the same result. - Parameters:
- supplier- supplier for the new value
- Returns:
- the current value.
 
- 
resetpublic void reset()Resets the current value.
 
-