1 package com.atlassian.plugin.module;
2
3 import java.util.Collection;
4
5 /**
6 * The ContainerAccessor allows access to the underlying plugin container (e.g. spring).
7 *
8 * @since 2.5.0
9 */
10 public interface ContainerAccessor
11 {
12 /**
13 * Will ask the container to instantiate a bean of the given class and does inject all constructor defined dependencies.
14 * Currently we have only spring as a container that will autowire this bean.
15 *
16 * @param clazz the Class to instantiate. Cannot be null.
17 *
18 * @return an instantiated bean.
19 */
20 <T> T createBean(Class<T> clazz);
21
22 /**
23 * Gets all the beans that implement a given interface
24 *
25 * @param interfaceClass The interface class
26 * @param <T> The target interface type
27 * @return A collection of implementations from the plugin's container
28 */
29 <T> Collection<T> getBeansOfType(Class<T> interfaceClass);
30 }