View Javadoc

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      /**
16       * Creates the module instance. The module class name can contain a prefix. The delimiter of the prefix and the class name is ':'.
17       * E.g.: 'bean:httpServletBean'. Which prefixes are supported depends on the registered {@link com.atlassian.plugin.module.ModuleCreator}.
18       * The prefix is case in-sensitive.
19       *
20       * @param name              module class name, can contain a prefix followed by ":" and the class name. Cannot be null
21       *                          If no prefix provided a default behaviour is assumed how to create the module class.
22       *
23       * @param moduleDescriptor  the {@link com.atlassian.plugin.ModuleDescriptor}. Cannot be null
24       *
25       * @return an instantiated object of the module class.
26       *
27       * @throws PluginParseException If it failed to create the object.
28       */
29      <T> T createModule(String name, ModuleDescriptor<T> moduleDescriptor) throws PluginParseException;
30  
31      /**
32       * Returns the module class. The module class name can contain a prefix. The delimiter of the prefix and the class name is ':'.
33       * E.g.: 'bean:httpServletBean'. Which prefixes are supported depends on the registered {@link com.atlassian.plugin.module.ModuleCreator}.
34       *
35       * @param name               module class name, can contain a prefix followed by ":" and the class name. Cannot be null.
36       *                           If no prefix provided a default behaviour is assumed how to create the module class.
37       * @param moduleDescriptor   the {@link com.atlassian.plugin.ModuleDescriptor}. Cannot be null
38       *
39       * @return the module class.
40       * @throws ModuleClassNotFoundException If the module class could not be found
41       */
42      //<T> Class<T> getModuleClass(String name, ModuleDescriptor<T> moduleDescriptor) throws ModuleClassNotFoundException;
43  
44      ModuleFactory LEGACY_MODULE_FACTORY = new LegacyModuleFactory();
45  }