Class ConcurrentLazyReference<T>
java.lang.Object
io.github.cowwoc.pouch10.core.ConcurrentLazyReference<T>
- Type Parameters:
T- the type of object being referenced
- All Implemented Interfaces:
Reference<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ConcurrentLazyReference<T> Creates a newConcurrentLazyReference.protected abstract TCreates the value.final TgetValue()Returns the value.booleanReturnstrueif the value was initialized.toString()
-
Constructor Details
-
ConcurrentLazyReference
protected ConcurrentLazyReference()Creates a new instance.
-
-
Method Details
-
create
Creates a newConcurrentLazyReference.- Type Parameters:
T- the type of value returned by the reference- Parameters:
supplier- supplies the reference value- Returns:
- a new
ConcurrentLazyReference
-
isInitialized
public boolean isInitialized()Returnstrueif the value was initialized.- Specified by:
isInitializedin interfaceReference<T>- Returns:
trueif the value was initialized
-
getValue
-
createValue
Creates the value. This method is invoked the first timegetValue()is invoked.- Returns:
- the value
-
toString
-