- java.lang.Object
-
- org.omnifaces.util.Lazy<T>
-
- Type Parameters:
T
- Type of object.
- All Implemented Interfaces:
Serializable
public final class Lazy<T> extends Object implements Serializable
Implements lazy-initialized object primarily for final and transient fields. Utilizes double-checked locking for optimization.Example:
private final Lazy<Object> lazy = new Lazy<>(Object::new); Object lazyInstance = lazy.get();
- Since:
- 3.9
- Author:
- Lenny Primak
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Lazy.SerializableSupplier<T>
-
Constructor Summary
Constructors Constructor Description Lazy(Lazy.SerializableSupplier<T> initFunction)
-
-
-
Constructor Detail
-
Lazy
public Lazy(Lazy.SerializableSupplier<T> initFunction)
-
-
Method Detail
-
get
public T get()
- Returns:
- Underlying object, initialize when necessary.
-
-