Package com.atlassian.plugin.module
Class PrefixDelegatingModuleFactory
java.lang.Object
com.atlassian.plugin.module.PrefixDelegatingModuleFactory
- All Implemented Interfaces:
ModuleFactory
The default implementation of a
ModuleFactory.
The module class name can contain a prefix and this prefix determines which ModuleFactory
is used to create the java class for this module descriptor.
If no prefix is supplied it will use ClassPrefixModuleFactory to create the module class object.
ModuleFactories are located via the following algorithm. First, the prefixes registered during construction are searched, then any implementations in the plugin's container, if applicable.
Implementation note: The plugin's container is searched, instead of
a general search for all OSGi services registered against PrefixModuleFactory, because the factories
have to be available before any modules are created, and Spring DM, for example, ensures all required service
references are available before creating the context, which is then interpreted as an enabled plugin.
- Since:
- 2.5.0
-
Field Summary
Fields inherited from interface com.atlassian.plugin.module.ModuleFactory
LEGACY_MODULE_FACTORY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPrefixModuleFactory(PrefixModuleFactory prefixModuleFactory) <T> TcreateModule(String className, ModuleDescriptor<T> moduleDescriptor) protected ModuleFactorygetModuleFactoryForPrefix(com.atlassian.plugin.module.PrefixDelegatingModuleFactory.ModuleReference moduleReference, ModuleDescriptor<?> moduleDescriptor) Returns the module factory for a prefix, first using registered prefixes, then any from the plugin's container.<T> Class<T>guessModuleClass(String name, ModuleDescriptor<T> moduleDescriptor) Deprecated.Since 2.5.0
-
Constructor Details
-
PrefixDelegatingModuleFactory
-
-
Method Details
-
addPrefixModuleFactory
-
getModuleFactoryForPrefix
protected ModuleFactory getModuleFactoryForPrefix(com.atlassian.plugin.module.PrefixDelegatingModuleFactory.ModuleReference moduleReference, ModuleDescriptor<?> moduleDescriptor) Returns the module factory for a prefix, first using registered prefixes, then any from the plugin's container.- Parameters:
moduleReference- The module referencemoduleDescriptor- The descriptor containing the module- Returns:
- The instance, can return null
-
createModule
- Specified by:
createModulein interfaceModuleFactory
-
guessModuleClass
Deprecated.Since 2.5.0This is not to be used. It is only for backwards compatibility with old code that usesPluginAccessor.getEnabledModulesByClass(Class). This method can and will be removed without warning.- Type Parameters:
T- The module class type- Parameters:
name- The class namemoduleDescriptor- The module descriptor- Returns:
- The module class
- Throws:
ModuleClassNotFoundException
-