Class LazyValue<T>
- java.lang.Object
-
- org.apache.jackrabbit.oak.commons.LazyValue<T>
-
- All Implemented Interfaces:
java.util.function.Supplier<T>
public abstract class LazyValue<T> extends java.lang.Object implements java.util.function.Supplier<T>
An instances of this class represents a lazy value of typeT
.LazyValue
implements an evaluate by need semantics:createValue()
is called exactly once whenget()
is called for the first time.LazyValue
instances are thread safe.
-
-
Constructor Summary
Constructors Constructor Description LazyValue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get()
Get value.boolean
hasValue()
-
-
-
Method Detail
-
hasValue
public boolean hasValue()
- Returns:
true
iffget()
has been called at least once.
-
get
public T get()
Get value. CallscreateValue()
if called for the first time.- Specified by:
get
in interfacejava.util.function.Supplier<T>
- Returns:
- the value
-
-