public class

PrefixDelegatingModuleFactory

extends Object
implements ModuleFactory
java.lang.Object
   ↳ com.atlassian.plugin.module.PrefixDelegatingModuleFactory

Class Overview

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.

Summary

[Expand]
Inherited Fields
From interface com.atlassian.plugin.module.ModuleFactory
Public Constructors
PrefixDelegatingModuleFactory(Set<PrefixModuleFactory> delegates)
Public Methods
void addPrefixModuleFactory(PrefixModuleFactory prefixModuleFactory)
<T> T createModule(String className, ModuleDescriptor<T> moduleDescriptor)
Creates the module instance.
@Deprecated <T> Class<T> guessModuleClass(String name, ModuleDescriptor<T> moduleDescriptor)
This method is deprecated. Since 2.5.0
Protected Methods
ModuleFactory getModuleFactoryForPrefix(PrefixDelegatingModuleFactory.ModuleReference moduleReference, ModuleDescriptor<?> moduleDescriptor)
Returns the module factory for a prefix, first using registered prefixes, then any from the plugin's container.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugin.module.ModuleFactory

Public Constructors

public PrefixDelegatingModuleFactory (Set<PrefixModuleFactory> delegates)

Public Methods

public void addPrefixModuleFactory (PrefixModuleFactory prefixModuleFactory)

public T createModule (String className, ModuleDescriptor<T> moduleDescriptor)

Creates the module instance. The module class name can contain a prefix. The delimiter of the prefix and the class name is ':'. E.g.: 'bean:httpServletBean'. Which prefixes are supported depends on the registered com.atlassian.plugin.module.ModuleCreator. The prefix is case in-sensitive.

Parameters
className 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 null
Returns
  • an instantiated object of the module class.

@Deprecated public Class<T> guessModuleClass (String name, ModuleDescriptor<T> moduleDescriptor)

This method is deprecated.
Since 2.5.0

This is not to be used. It is only for backwards compatibility with old code that uses getEnabledModulesByClass(Class). This method can and will be removed without warning.

Parameters
name The class name
moduleDescriptor The module descriptor
Returns
  • The module class
Throws
ModuleClassNotFoundException
ModuleClassNotFoundException

Protected Methods

protected ModuleFactory getModuleFactoryForPrefix (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 reference
moduleDescriptor The descriptor containing the module
Returns
  • The instance, can return null