public class DefaultPluginManager extends Object implements PluginManager
| Modifier and Type | Field and Description |
|---|---|
protected AnnotationProcessor |
annotationProcessor |
protected PluginContext |
context |
protected DependencyResolver |
dependencyResolver |
| Constructor and Description |
|---|
DefaultPluginManager(PluginContext context,
AnnotationProcessor annotationProcessor,
DependencyResolver dependencyResolver)
Ideally not for public usage.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
create(Class<?> refClass) |
Collection<PluginRef> |
getAllPlugins()
Return the complete list of all the plugins currently registered
|
<T> T |
getPlugin(Class<T> pluginClass)
Return an instance of the plugin matching the given type
given type
|
<T> T |
getPlugin(String name)
Return an instance of the plugin that is registered with the given name
|
Collection<Object> |
loadPlugins(PluginSource source)
Load a set of plugin retrieved from the give
PluginSource,
instantiating the objects, resolving any dependency and registering them
in the context |
<T> void |
register(String name,
T plugin)
Register a plugin in the context with the given name
|
<T> void |
register(T plugin)
Register a plugin in the context
|
<T> T |
removePlugin(String name)
Remove a plugin with the given name from the context
|
<T> T |
removePlugin(T plugin)
Remove a plugin from the context
|
protected final PluginContext context
protected final AnnotationProcessor annotationProcessor
protected final DependencyResolver dependencyResolver
public DefaultPluginManager(PluginContext context, AnnotationProcessor annotationProcessor, DependencyResolver dependencyResolver)
PluginManagers.defaultPluginManager() instead for a fully
configured DefaultPluginManagercontext - the PluginContext to useannotationProcessor - the AnnotationProcessor to usedependencyResolver - the DependencyResolver to usepublic <T> void register(T plugin)
PluginManagerregister in interface PluginManagerT - the inferred type of the pluginplugin - the plugin object to registerpublic <T> void register(String name, T plugin)
PluginManagerregister in interface PluginManagerT - the inferred type of the pluginname - the name to associate with the pluginplugin - the plugin object to registerpublic <T> T getPlugin(String name)
PluginManagergetPlugin in interface PluginManagerT - the inferred type of the pluginname - the name of the pluginnull if none existspublic <T> T getPlugin(Class<T> pluginClass)
PluginManagergetPlugin in interface PluginManagerT - the inferred type of the pluginpluginClass - type the plugin must match; can be an interface or superclass. Cannot be nullnull if none existspublic Collection<PluginRef> getAllPlugins()
PluginManagergetAllPlugins in interface PluginManagerCollection of all the pluginspublic <T> T removePlugin(String name)
PluginManagerremovePlugin in interface PluginManagerT - the inferred type of the pluginname - the name associated with the pluginnull if none is existspublic <T> T removePlugin(T plugin)
PluginManagerremovePlugin in interface PluginManagerT - the inferred type of the pluginplugin - the plugin instance to removenull if none is existspublic Collection<Object> loadPlugins(PluginSource source) throws Exception
PluginManagerPluginSource,
instantiating the objects, resolving any dependency and registering them
in the contextloadPlugins in interface PluginManagersource - the PluginSource to use for loadingnullException - an exception that occurred during loading, see PluginSource.load()Copyright © 2017–2018 PlugFace. All rights reserved.