1 package com.atlassian.plugin.module;
2
3 import com.atlassian.plugin.ModuleDescriptor;
4 import com.atlassian.plugin.PluginParseException;
5
6 /**
7 * The {@link ModuleFactory} creates the module class of a {@link com.atlassian.plugin.ModuleDescriptor}.
8 * The ModuleFactory is injected into the {@link com.atlassian.plugin.descriptors.AbstractModuleDescriptor} and encapsulates the different
9 * strategies how the module class can be created.
10 *
11 * @since 2.5.0
12 */
13 public interface ModuleFactory {
14 /**
15 * Creates the module instance. The module class name can contain a prefix. The delimiter of the prefix and the class name is ':'.
16 * E.g.: 'bean:httpServletBean'. Which prefixes are supported depends on the registered {@link com.atlassian.plugin.module.ModuleCreator}.
17 * The prefix is case in-sensitive.
18 *
19 * @param name module class name, can contain a prefix followed by ":" and the class name. Cannot be null
20 * If no prefix provided a default behaviour is assumed how to create the module class.
21 * @param moduleDescriptor the {@link com.atlassian.plugin.ModuleDescriptor}. Cannot be null
22 * @return an instantiated object of the module class.
23 * @throws PluginParseException If it failed to create the object.
24 */
25 <T> T createModule(String name, ModuleDescriptor<T> moduleDescriptor) throws PluginParseException;
26
27 /**
28 * Returns the module class. The module class name can contain a prefix. The delimiter of the prefix and the class name is ':'.
29 * E.g.: 'bean:httpServletBean'. Which prefixes are supported depends on the registered {@link com.atlassian.plugin.module.ModuleCreator}.
30 *
31 * @param name module class name, can contain a prefix followed by ":" and the class name. Cannot be null.
32 * If no prefix provided a default behaviour is assumed how to create the module class.
33 * @param moduleDescriptor the {@link com.atlassian.plugin.ModuleDescriptor}. Cannot be null
34 * @return the module class.
35 * @throws ModuleClassNotFoundException If the module class could not be found
36 */
37 //<T> Class<T> getModuleClass(String name, ModuleDescriptor<T> moduleDescriptor) throws ModuleClassNotFoundException;
38
39 ModuleFactory LEGACY_MODULE_FACTORY = new LegacyModuleFactory();
40 }