T - the type of the lazily referenced elementpublic interface Lazy<T> extends Referencing<T>
Note that the shortened name has been chosen intentionally to optimize readability in class design.
Also note that a type like this is strongly required in order to implement lazy loading behavior in an application in an architecturally clean and proper way. I.e. the application's data model design has to define that a certain reference is meant to be capable of lazy-loading. If such a definition is not done, a loading logic is strictly required to always load the encountered reference, as it is defined by the "normal" way of how references work. Any "tricks" of whatever framework to "sneak in" lazy loading behavior where it hasn't actually been defined are nothing more than dirty hacks and mess up if not destroy the program's consistency of state (e.g. antipatterns like secretly replacing a well-defined collection instance with a framework-proprietary proxy instance of a "similar" collection implementation). In proper architectured sofware, if a reference does not define lazy loading capacity, it is not wanted to have that capacity on the business logical level by design in the first place. Any attempts of saying "but I want it anyway in a sneaky 'transparent' way" indicate ambivalent conflicting design errors and thus in the end poor design.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Lazy.Check |
static interface |
Lazy.Checker |
static interface |
Lazy.ClearingEvaluator |
static class |
Lazy.Default<T> |
| Modifier and Type | Method and Description |
|---|---|
static Lazy.Checker |
Checker() |
static Lazy.Checker |
Checker(double memoryQuota) |
static Lazy.Checker |
Checker(Lazy.Check customCheck) |
static Lazy.Checker |
Checker(long millisecondTimeout) |
static Lazy.Checker |
Checker(long millisecondTimeout,
double memoryQuota) |
static Lazy.Checker |
Checker(long millisecondTimeout,
double memoryQuota,
Lazy.Check customCheck,
LazyReferenceManager.CycleEvaluator cycleEvaluator) |
static Lazy.Checker |
CheckerMemory(double memoryQuota) |
static Lazy.Checker |
CheckerTimeout(long millisecondTimeout) |
T |
clear() |
boolean |
clear(Lazy.ClearingEvaluator clearingEvaluator) |
static void |
clear(Lazy<?> reference) |
T |
get()
Returns the referenced object, loading it if required.
|
static <T> T |
get(Lazy<T> reference) |
boolean |
isLoaded() |
static boolean |
isLoaded(Lazy<?> reference) |
boolean |
isStored() |
static boolean |
isStored(Lazy<?> reference) |
long |
lastTouched()
Returns the timestamp (corresponding to
System.currentTimeMillis()) when this instance has last been
"touched", meaning having its reference modified or queried. |
static <T> Lazy<T> |
New(long objectId) |
static <T> Lazy<T> |
New(long objectId,
ObjectSwizzling loader) |
static <T> Lazy<T> |
New(T subject,
long objectId,
ObjectSwizzling loader) |
T |
peek()
Returns the local reference without loading the referenced object if it is not present.
|
static <T> T |
peek(Lazy<T> reference) |
static <T> Lazy<T> |
Reference(T subject) |
static <T,L extends Lazy<T>> |
register(L lazyReference) |
T get()
get in interface Referencing<T>T peek()
lastTouched() will not be changed by calling this method.T clear()
boolean isStored()
boolean isLoaded()
long lastTouched()
System.currentTimeMillis()) when this instance has last been
"touched", meaning having its reference modified or queried.boolean clear(Lazy.ClearingEvaluator clearingEvaluator)
static <T> T get(Lazy<T> reference)
static <T> T peek(Lazy<T> reference)
static void clear(Lazy<?> reference)
static boolean isStored(Lazy<?> reference)
static boolean isLoaded(Lazy<?> reference)
static <T> Lazy<T> Reference(T subject)
static <T> Lazy<T> New(long objectId)
static <T> Lazy<T> New(long objectId, ObjectSwizzling loader)
static <T> Lazy<T> New(T subject, long objectId, ObjectSwizzling loader)
static <T,L extends Lazy<T>> L register(L lazyReference)
static Lazy.Checker Checker()
static Lazy.Checker Checker(long millisecondTimeout)
static Lazy.Checker Checker(double memoryQuota)
static Lazy.Checker Checker(long millisecondTimeout, double memoryQuota)
static Lazy.Checker Checker(Lazy.Check customCheck)
static Lazy.Checker Checker(long millisecondTimeout, double memoryQuota, Lazy.Check customCheck, LazyReferenceManager.CycleEvaluator cycleEvaluator)
static Lazy.Checker CheckerTimeout(long millisecondTimeout)
static Lazy.Checker CheckerMemory(double memoryQuota)
Copyright © 2022 MicroStream Software. All rights reserved.