Package org.mule.amf.impl.util
Class LazyValue<T>
java.lang.Object
org.mule.amf.impl.util.LazyValue<T>
- Type Parameters:
T- the generic type of the provided value
- All Implemented Interfaces:
Supplier<T>
Provides a value which may be lazily computed.
The value is only computed on the first invokation of get(). Subsequent calls to such method will always return the
same value.
This class is thread-safe. When invoking get(), it is guaranteed that the value will be computed only once.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LazyValue
Creates a new instance which lazily obtains its value from the givensupplier. It is guaranteed thatSupplier.get()will only be invoked once. Because this class is thread-safe, the supplier is not required to be.- Parameters:
supplier- ASupplierthrough which the value is obtained
-
-
Method Details