public class PluginBus
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
addPlugInvoker(java.lang.Class<?> plugInterface,
PlugInvoker<?> plugInvoker) |
static boolean |
canInvoke(java.lang.Object target)
Test if a method can be invoked on the given target
Object . |
protected <T> java.util.List<T> |
doGetPlugs(java.lang.Class<T> plugInterface,
boolean includeExtendedInterfaces) |
static PluginBus |
getInstance() |
static <T> T |
getPlug(java.lang.Class<?> plugInterface) |
static <T> T |
getPluggedObject(java.lang.Object plug)
Gets the
Object that is attached to given plug. |
static java.util.List<PluginComponent> |
getPluginComponents() |
static <T> java.util.List<T> |
getPlugins(java.lang.Class<T> plugInterface)
Gets the plugins having exactly the specified plug interface.
|
static <T extends PlugInvoker<?>> |
getPlugInvoker(java.lang.Class<?> plugInterface) |
static <T> java.util.List<T> |
getPlugs(java.lang.Class<T> plugInterface)
Gets the plugs (i.e.
|
static <T> java.util.List<T> |
getPlugs(java.lang.Class<T> plugInterface,
boolean includeExtendedInterfaces)
Gets the plugs (i.e.
|
static boolean |
hasPlug(java.lang.Class<?> plugInterface) |
static boolean |
hasPlugInvoker(java.lang.Class<?> plugInterface) |
static void |
injectPlugs(java.lang.Object plugin) |
static void |
injectPlugs(java.lang.Object plugin,
boolean useHandler) |
static boolean |
isPlugged(java.lang.Object object)
Tests if the given
Object is currently plugged as a plugin into this PluginBus . |
static boolean |
isPlugin(java.lang.Class<?> pluginClass)
Tests if the specified class represents a plugin object.
|
static <T> T |
plug(java.lang.Class<?> pluginClass)
Plugs an instance of specific
Class to this PluginBus . |
static <T> T |
plug(java.lang.Class<?> pluginClass,
DependencyScope scope)
Plugs an instance of specific
Class to this PluginBus . |
static void |
plug(java.util.List<java.lang.Object> plugins)
Plugs the the given plugin
Object s to this PluginBus . |
static void |
plug(java.lang.Object... plugins)
Plugs the the given plugin
Object s to this PluginBus . |
static void |
plug(java.lang.Object plugin)
Plugs the the given plugin
Object to this PluginBus . |
static void |
plug(java.lang.Object plugin,
boolean useHandler) |
void |
plug(java.lang.Object plugin,
java.lang.Class<?> plugInterface,
PlugInvoker<?> plugInvoker,
HandlerInvoker<?> handlerInvoker)
This framework method should not be used by developers directly.
|
static void |
unplug(java.lang.Object plugin) |
public static <T> java.util.List<T> getPlugins(java.lang.Class<T> plugInterface)
plugInterface
- A Class
specifying the plug interface.List
containing the plugins.public static <T> java.util.List<T> getPlugs(java.lang.Class<T> plugInterface)
PlugInvoker
s) having exactly the specified plug interface.
Extended interfaces are included.plugInterface
- A Class
specifying the plug interface.List
containing the plugs (i.e. PlugInvoker
s) .public static <T> java.util.List<T> getPlugs(java.lang.Class<T> plugInterface, boolean includeExtendedInterfaces)
PlugInvoker
s) having exactly the specified plug interface.plugInterface
- A Class
specifying the plug interface.includeExtendedInterfaces
- A boolean
flag specifying if the extended interfaces
are included.List
containing the plugs (i.e. PlugInvoker
s) .protected <T> java.util.List<T> doGetPlugs(java.lang.Class<T> plugInterface, boolean includeExtendedInterfaces)
public static <T> T getPlug(java.lang.Class<?> plugInterface)
public static boolean hasPlug(java.lang.Class<?> plugInterface)
public static java.util.List<PluginComponent> getPluginComponents()
public static PluginBus getInstance()
public static void addPlugInvoker(java.lang.Class<?> plugInterface, PlugInvoker<?> plugInvoker)
public static boolean hasPlugInvoker(java.lang.Class<?> plugInterface)
public static <T extends PlugInvoker<?>> T getPlugInvoker(java.lang.Class<?> plugInterface)
public static <T> T plug(java.lang.Class<?> pluginClass)
Class
to this PluginBus
.pluginClass
- A Class
Object
public static <T> T plug(java.lang.Class<?> pluginClass, DependencyScope scope)
Class
to this PluginBus
. The instance is obtained
using the given DependencyScope
.pluginClass
- A Class
scope
- A DependencyScope
.Object
public static void plug(java.lang.Object plugin)
Object
to this PluginBus
.plugin
- A plugin Object
.public static void plug(java.lang.Object... plugins)
Object
s to this PluginBus
.plugins
- A variable length list plugin Object
s.public static void plug(java.util.List<java.lang.Object> plugins)
Object
s to this PluginBus
.plugins
- A List
containing the plugin Object
s to be plugged.public static void plug(java.lang.Object plugin, boolean useHandler)
public static void injectPlugs(java.lang.Object plugin)
public static void injectPlugs(java.lang.Object plugin, boolean useHandler)
public void plug(java.lang.Object plugin, java.lang.Class<?> plugInterface, PlugInvoker<?> plugInvoker, HandlerInvoker<?> handlerInvoker)
plugin
- The plugin to be plugged as an Object
.plugInterface
- A Class
specifying the plugin interface type.plugInvoker
- A PlugInvoker
instance. May be null
if an instance of needed
type of PlugInvoker
is already cached in this PluginBus
.handlerInvoker
- A HandlerInvoker
instance. May be null
if there
is no needed for synchronising invocations with the main thread.public static void unplug(java.lang.Object plugin)
public static boolean isPlugged(java.lang.Object object)
Object
is currently plugged as a plugin into this PluginBus
.object
- An Object
.boolean
value.public static boolean canInvoke(java.lang.Object target)
Object
. The target may not be
null
, and in case of PlugInvoker
it has to contain plugins.target
- An Object
.boolean
value.public static boolean isPlugin(java.lang.Class<?> pluginClass)
pluginClass
- A Class
.boolean
value.public static <T> T getPluggedObject(java.lang.Object plug)
Object
that is attached to given plug.plug
- A plug as an Object
Object
.