Package com.atlassian.confluence.util
Class MemoizingComponentReference
java.lang.Object
com.atlassian.confluence.util.MemoizingComponentReference
Lazily loads the component from the
ContainerManager
and memoize the result.
TODO add the equivalent of this to atlassian spring, to replace LazyComponentReference
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Supplier<T>
containerComponent
(String name) Static factory that takes the component name and the type.static <T> Supplier<T>
osgiService
(Class<T> clazz) Static factory that takes the desired OSGi service type.
-
Constructor Details
-
MemoizingComponentReference
public MemoizingComponentReference()
-
-
Method Details
-
containerComponent
Static factory that takes the component name and the type.Note this is unsafe as it doesn't actually cast until the usage site due to erasure.
- Type Parameters:
T
- the component type- Parameters:
name
- the name of the component- Returns:
- the accessed component or any exception encountered when trying to retrieve it
-
osgiService
Static factory that takes the desired OSGi service type.Note this is unsafe as it doesn't actually cast until the usage site due to erasure.
-