Package com.atlassian.crowd.plugin
Class PluginComponentAccessor
java.lang.Object
com.atlassian.crowd.plugin.PluginComponentAccessor
Utility class to access OSGi components publicly exported by plugins.
- Since:
- v2.7
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
getOSGiComponentInstanceOfType
(Class<T> clazz) Returns an instance of the service identified by the given interface, as exported by a plugin module.static <T> List<T>
getOSGiComponentsInstanceOfType
(Class<T> clazz) Returns an instances of the service identified by the given interface, as exported by a plugin module.
-
Constructor Details
-
PluginComponentAccessor
public PluginComponentAccessor()
-
-
Method Details
-
getOSGiComponentInstanceOfType
Returns an instance of the service identified by the given interface, as exported by a plugin module.Warning: as the instance returned comes from OSGi-land, it can become invalid at anytime (if the plugin is disabled/enabled for instance). For this reason, it should NEVER be cached (e.g stored in a field variable).
- Type Parameters:
T
- the interface type- Parameters:
clazz
- the interface of the service- Returns:
- an instance of the service, or
null
if no plugin publicly exports this particular service.
-
getOSGiComponentsInstanceOfType
Returns an instances of the service identified by the given interface, as exported by a plugin module.Warning: as the instance returned comes from OSGi-land, it can become invalid at anytime (if the plugin is disabled/enabled for instance). For this reason, it should NEVER be cached (e.g stored in a field variable).
- Type Parameters:
T
- the interface type- Parameters:
clazz
- the interface of the service- Returns:
- instances of the services implementing given interface
-