Class MemoizingComponentReference

java.lang.Object
com.atlassian.confluence.util.MemoizingComponentReference

public class MemoizingComponentReference extends Object
Lazily loads the component from the ContainerManager and memoize the result.

TODO add the equivalent of this to atlassian spring, to replace LazyComponentReference.

  • Constructor Details

    • MemoizingComponentReference

      public MemoizingComponentReference()
  • Method Details

    • 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
    • osgiService

      public static <T> Supplier<T> osgiService(Class<T> clazz)
      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.