Package com.atlassian.confluence.util
Class MemoizingComponentReference
- java.lang.Object
-
- com.atlassian.confluence.util.MemoizingComponentReference
-
public class MemoizingComponentReference extends Object
Lazily loads the component from theContainerManagerand memoize the result.TODO add the equivalent of this to atlassian spring, to replace
LazyComponentReference.
-
-
Constructor Summary
Constructors Constructor Description MemoizingComponentReference()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <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.
-
-
-
Method Detail
-
containerComponent
public static <T> Supplier<T> containerComponent(String name)
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
-
-