ComponentAccessor
instead (or inject dependencies where possible)@Deprecated @Internal public class ComponentManager extends Object
ComponentManager
, which has been
moved. It exists simply to avoid breaking any plugins that still refer to this class in its old location (i.e. here).
This class will be removed in Jira 8.0; plugins should be using ComponentAccessor
anyway.Modifier and Type | Field and Description |
---|---|
static String |
EXTENSION_PROVIDER_PROPERTY
Deprecated.
since 4.3; this extension point is being removed in Jira 8.0
|
Constructor and Description |
---|
ComponentManager()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
getComponent(Class<T> componentClass)
Deprecated.
Retrieves and returns a component which is an instance of given class.
|
static <T> T |
getComponentInstanceOfType(Class<T> type)
Deprecated.
Retrieves and returns a component which is an instance of given class.
|
static <T> List<T> |
getComponentsOfType(Class<T> type)
Deprecated.
Returns all the components inside Pico that are instances of the given class.
|
static <T> Map<String,T> |
getComponentsOfTypeMap(Class<T> type)
Deprecated.
Returns all the components currently inside Pico which are instances of the given class, mapping them to their
component key.
|
static ComponentManager |
getInstance()
Deprecated.
Retuns the component manager.
|
static <T> T |
getOSGiComponentInstanceOfType(Class<T> type)
Deprecated.
Retrieves and returns a public component from OSGi land via its class name.
|
public static final String EXTENSION_PROVIDER_PROPERTY
@Nullable public static <T> T getComponent(Class<T> componentClass)
In practise, this is the same as getComponentInstanceOfType(Class)
except it will fail faster if the
given Class is not a known component key (it also has a shorter and more meaningful name).
Please note that this method only gets components from JIRA's core Pico Container. That is, it retrieves
core components and components declared in Plugins1 plugins, but not components declared in Plugins2 plugins.
Plugins2 components can be retrieved via the getOSGiComponentInstanceOfType(Class)
method, but only if
they are public.
componentClass
- class to find a component instance bygetOSGiComponentInstanceOfType(Class)
public static <T> T getComponentInstanceOfType(Class<T> type)
In practise, this is the same as getComponent(Class)
except it will try to find a unique component that
implements/extends the given Class even if the Class is not an actual component key.
Please note that this method only gets components from JIRA's core Pico Containter. That is, it retrieves
core components and components declared in Plugins1 plugins, but not components declared in Plugins2 plugins.
Plugins2 components can be retrieved via the getOSGiComponentInstanceOfType(Class)
method, but only if
they are public.
type
- class to find a component instance bygetOSGiComponentInstanceOfType(Class)
public static <T> List<T> getComponentsOfType(Class<T> type)
type
- the class for which to searchpublic static <T> Map<String,T> getComponentsOfTypeMap(Class<T> type)
type
- the type for which to search@Nonnull public static ComponentManager getInstance()
@Nullable public static <T> T getOSGiComponentInstanceOfType(Class<T> type)
Plugin developers should prefer the API method ComponentAccessor.getOSGiComponentInstanceOfType(Class)
.
It is important to note that this only works for public components. That is components with public="true"
declared in their XML configuration. This means that they are available for other plugins to
import.
A use case for this is when for example for the dashboards plugin. In several areas in JIRA we may want to
render gadgets via the GadgetViewFactory
. Whilst the interface for this
component is available in JIRA core, the implementation is provided by the dashboards OSGi bundle. This method
will allow us to access it.
type
- class to find an OSGi component instance forgetComponentInstanceOfType(Class)
Copyright © 2002-2018 Atlassian. All Rights Reserved.