com.atlassian.plugin.module
Interface ContainerAccessor

All Known Subinterfaces:
SpringContainerAccessor
All Known Implementing Classes:
DefaultSpringContainerAccessor

public interface ContainerAccessor

The ContainerAccessor allows access to the underlying plugin container (e.g. spring).

Since:
2.5.0

Method Summary
<T> T
createBean(Class<T> clazz)
          Will ask the container to instantiate a bean of the given class and does inject all constructor defined dependencies.
<T> T
getBean(String id)
          Retrieves a bean by name from the container.
<T> Collection<T>
getBeansOfType(Class<T> interfaceClass)
          Gets all the beans that implement a given interface
<T> T
injectBean(T bean)
          Injects an existing bean instance with any dependencies via setters or private field injection
 

Method Detail

createBean

<T> T createBean(Class<T> clazz)
Will ask the container to instantiate a bean of the given class and does inject all constructor defined dependencies. Currently we have only spring as a container that will autowire this bean.

Parameters:
clazz - the Class to instantiate. Cannot be null.
Returns:
an instantiated bean.

injectBean

<T> T injectBean(T bean)
Injects an existing bean instance with any dependencies via setters or private field injection

Type Parameters:
T - The bean type
Parameters:
bean - The instantiated bean to inject
Since:
3.0

getBean

<T> T getBean(String id)
Retrieves a bean by name from the container.

Parameters:
id - the id of the container bean, cannot be null
Returns:
the bean object, or null if cannot be found
Since:
3.0

getBeansOfType

<T> Collection<T> getBeansOfType(Class<T> interfaceClass)
Gets all the beans that implement a given interface

Type Parameters:
T - The target interface type
Parameters:
interfaceClass - The interface class
Returns:
A collection of implementations from the plugin's container


Copyright © 2014 Atlassian. All rights reserved.