Class LazyReference<T>
- java.lang.Object
-
- org.forgerock.openig.decoration.helper.LazyReference<T>
-
- Type Parameters:
T
- expected type of the resolved reference object
public final class LazyReference<T> extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get()
Resolves the encapsulated reference.static <R> LazyReference<R>
newReference(Heap heap, JsonValue reference, Class<R> type, boolean optional)
Builds a LazyReference dedicated to resolve the given (optional or not)reference
of typetype
from the givenheap
.
-
-
-
Method Detail
-
newReference
public static <R> LazyReference<R> newReference(Heap heap, JsonValue reference, Class<R> type, boolean optional)
Builds a LazyReference dedicated to resolve the given (optional or not)reference
of typetype
from the givenheap
.- Type Parameters:
R
- expected resolved type of the reference- Parameters:
heap
- Heap instance that will try to resolve the referencereference
- Reference to be resolved (can be an inline declaration)type
- expected resolved type of the referenceoptional
- is this reference optional (returnnull
if the givenreference
wraps anull
value)- Returns:
- a new LazyReference
-
get
public T get() throws HeapException
Resolves the encapsulated reference. Notice that synchronization is done in the Heap, so no need to cover that here.- Returns:
- the resolved instance, or
null
if it was optional and not set. - Throws:
HeapException
- if resolution failed, this error is the one thrown be the heap, untouched.
-
-