public class PrefixDelegatingModuleFactory extends Object implements ModuleFactory
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.LEGACY_MODULE_FACTORY| Constructor and Description |
|---|
PrefixDelegatingModuleFactory(Set<PrefixModuleFactory> delegates) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPrefixModuleFactory(PrefixModuleFactory prefixModuleFactory) |
<T> T |
createModule(String className,
ModuleDescriptor<T> moduleDescriptor)
Creates the module instance.
|
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.
|
<T> Class<T> |
guessModuleClass(String name,
ModuleDescriptor<T> moduleDescriptor)
Deprecated.
Since 2.5.0
|
public PrefixDelegatingModuleFactory(Set<PrefixModuleFactory> delegates)
public void addPrefixModuleFactory(PrefixModuleFactory prefixModuleFactory)
protected ModuleFactory getModuleFactoryForPrefix(com.atlassian.plugin.module.PrefixDelegatingModuleFactory.ModuleReference moduleReference, ModuleDescriptor<?> moduleDescriptor)
moduleReference - The module referencemoduleDescriptor - The descriptor containing the modulepublic <T> T createModule(String className, ModuleDescriptor<T> moduleDescriptor) throws PluginParseException
ModuleFactorycom.atlassian.plugin.module.ModuleCreator.
The prefix is case in-sensitive.createModule in interface ModuleFactoryclassName - module class name, can contain a prefix followed by ":" and the class name. Cannot be null
If no prefix provided a default behaviour is assumed how to create the module class.moduleDescriptor - the ModuleDescriptor. Cannot be nullPluginParseException - If it failed to create the object.@Deprecated public <T> Class<T> guessModuleClass(String name, ModuleDescriptor<T> moduleDescriptor) throws ModuleClassNotFoundException
PluginAccessor.getEnabledModulesByClass(Class). This method can and will be
removed without warning.T - The module class typename - The class namemoduleDescriptor - The module descriptorModuleClassNotFoundExceptionCopyright © 2014 Atlassian. All rights reserved.