Package org.forgerock.openig.heap
Interface Heap
- All Known Implementing Classes:
EnvironmentHeap
,HeapImpl
public interface Heap
Manages a collection of associated objects created and initialized by
Heaplet
objects. A heap object may be lazily initialized, meaning that it or its dependencies
may not be created until first requested from the heap.-
Method Summary
Modifier and TypeMethodDescription<T> T
Returns an object from the heap with a specified name, ornull
if no such object exists.getName()
Returns the name of this heap.Returns the properties from this heap and its parents if any.<T> T
Resolves a mandatory object with the specified reference.<T> T
Resolves an object with the specified reference, optionally or not.
-
Method Details
-
getName
Name getName()Returns the name of this heap.- Returns:
- the name of this heap.
-
get
Returns an object from the heap with a specified name, ornull
if no such object exists.- Type Parameters:
T
- expected type of the heap object- Parameters:
name
- the name of the object in the heap to be retrieved.type
- expected type of the heap object- Returns:
- the requested object from the heap, or
null
if no such object exists. - Throws:
HeapException
- if an exception occurred during creation of the heap object or any of its dependencies.JsonValueException
- if a heaplet (or one of its dependencies) has a malformed configuration object.
-
resolve
Resolves a mandatory object with the specified reference. If the object does not exist or the inline declaration cannot be build, aJsonValueException
is thrown. If the reference is an inline object declaration, an anonymous object is added to the heap and returned.Equivalent to:
heap.resolve(reference, type, false);
- Type Parameters:
T
- expected instance type- Parameters:
reference
- a JSON value containing the name of the heap object to retrieve.type
- the expected type of the heap object.- Returns:
- the specified heap object.
- Throws:
HeapException
- if there was an exception creating the heap object or any of its dependencies.JsonValueException
- if the name containsnull
, is not a string, or the specified heap object could not be retrieved or has the wrong type or the reference is not a valid inline declaration.
-
resolve
Resolves an object with the specified reference, optionally or not. If the reference is an inline object declaration, an anonymous object is added to the heap and returned. If the inline declaration cannot be build, aJsonValueException
is thrown.- Type Parameters:
T
- expected instance type- Parameters:
reference
- a JSON value containing either the name of the heap object to retrieve or an inline declaration.type
- the expected type of the heap object.optional
- Accept or not a JsonValue that contains null.- Returns:
- the referenced heap object or
null
if name containsnull
. - Throws:
HeapException
- if there was an exception creating the heap object or any of its dependencies.JsonValueException
- if the reference is not a string, or the specified heap object has the wrong type or the reference is not a valid inline declaration.
-
getProperties
Bindings getProperties()Returns the properties from this heap and its parents if any.- Returns:
- the properties from this heap and its parents if any.
-