1 package com.atlassian.plugin;
2
3 /**
4 * Defines a plugin that is capable of creating and autowiring beans. The name and autowire types copied from Spring's
5 * AutowireCapableBeanFactory.
6 */
7 public interface AutowireCapablePlugin
8 {
9
10 /**
11 * The autowire strategy to use when creating and wiring a bean
12 */
13 /** Performs no autowiring */
14 public static final int AUTOWIRE_NO = 1;
15
16 /** Performs setter-based injection by name */
17 public static final int AUTOWIRE_BY_NAME = 2;
18
19 /** Performs setter-based injection by type */
20 public static final int AUTOWIRE_BY_TYPE = 3;
21
22 /** Performs construction-based injection by type */
23 public static final int AUTOWIRE_BY_CONSTRUCTOR = 4;
24
25 /**
26 * Autodetects appropriate injection by first seeing if any no-arg constructors exist. If not, performs constructor
27 * injection, and if so, autowires by type then name
28 */
29 public static final int AUTOWIRE_AUTODETECT = 5;
30
31 /**
32 * Creates and autowires a class using the default strategy.
33 * @param clazz The class to create
34 * @return The created and wired bean
35 */
36 Object autowire(Class clazz);
37
38 /**
39 * Creates and autowires a class with a specific autowire strategy
40 *
41 * @param clazz The class to create
42 * @param autowireStrategy The autowire strategy
43 * @return The created and wired bean
44 */
45 Object autowire(Class clazz, int autowireStrategy);
46 }