1 package com.atlassian.plugin.hostcontainer;
2
3 /**
4 * Interface into the host application's dependency injection system. The implementation will be expected to be able
5 * to instantiate modules and possibly {@link com.atlassian.plugin.ModuleDescriptor} instances via constructor
6 * injection, matching the constructor with the largest number of arguments first.
7 *
8 * @since 2.2.0
9 */
10 public interface HostContainer
11 {
12 /**
13 * Constructs an instance of a class, matching the constructor with the largest number of arguments first, and
14 * autowires as appropriate. Actual method of autowiring may vary between implementations, though all should
15 * support constructor injection.
16 *
17 * @param moduleClass The class
18 * @return An instance of the passed class
19 * @throws IllegalArgumentException If unable to instantiate the class
20 */
21 <T> T create(Class<T> moduleClass) throws IllegalArgumentException;
22
23 /**
24 * Gets an existing implementation of an interface in the underlying object container
25 *
26 * @param moduleClass The bean interface
27 * @return The existing implementation
28 */
29 <T> T getInstance(Class<T> moduleClass);
30 }