Package overit.geocall.util
Class Lazy<T>
java.lang.Object
overit.geocall.util.Lazy<T>
- All Implemented Interfaces:
Serializable
Lazy is a simple in-memory caching class. The Lazy class suits the
caching of database calls, complex object graph building routines and web
service calls that should be cached for performance.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSimple serializable supplier interface. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Serializableprotected final Lazy.SerializableSupplier<T> protected Object -
Constructor Summary
ConstructorsConstructorDescriptionLazy()Creates an empty Lazy.Lazy(Lazy.SerializableSupplier<T> supplier) Creates a Lazy object with the definedLazy.SerializableSupplier. -
Method Summary
-
Field Details
-
NULL
-
supplier
-
value
-
-
Constructor Details
-
Lazy
public Lazy()Creates an empty Lazy. -
Lazy
Creates a Lazy object with the definedLazy.SerializableSupplier.- Parameters:
supplier- TheLazy.SerializableSupplier.
-
-
Method Details
-
get
Returns the value retrieved from the supplier.- Returns:
- The value retrieved from the supplier.
-
get
Returns the value retrieved from the supplier.- Parameters:
def- Default value to return.- Returns:
- The value retrieved from the supplier.
-
get
Returns the value retrieved from theLazy.SerializableSupplier.- Parameters:
supplier- TheLazy.SerializableSupplier.def- The default value to return in case the value retrieved from theLazy.SerializableSupplieris null.- Returns:
- The value retrieved from the
Lazy.SerializableSupplier.
-