public interface PluginContext
Modifier and Type | Method and Description |
---|---|
<T> void |
addPlugin(String name,
T plugin)
Register a plugin in the context with the given name
|
<T> void |
addPlugin(T plugin)
Register a plugin in the context
|
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 pluginName)
Return an instance of the plugin that is registered with the given name
|
<T> boolean |
hasPlugin(Class<T> pluginClass)
Check if the context has a plugin with the given type
|
boolean |
hasPlugin(String pluginName)
Check if the context has a plugin with the given name
|
<T> T |
removePlugin(String pluginName)
Remove a plugin with the given name from the context
|
<T> T |
removePlugin(T plugin)
Remove a plugin from the context
|
@Nullable <T> T getPlugin(String pluginName)
T
- the inferred type of the pluginpluginName
- the name of the pluginnull
if none exists@Nullable <T> T getPlugin(Class<T> pluginClass)
T
- the inferred type of the pluginpluginClass
- type the plugin must match; can be an interface or superclass. Cannot be null
null
if none existsCollection<PluginRef> getAllPlugins()
Collection
of all the plugins<T> void addPlugin(T plugin)
T
- the inferred type of the pluginplugin
- the plugin object to register<T> void addPlugin(String name, T plugin)
T
- the inferred type of the pluginname
- the name to associate with the pluginplugin
- the plugin object to register@Nullable <T> T removePlugin(T plugin)
T
- the inferred type of the pluginplugin
- the plugin instance to removenull
if none is exists@Nullable <T> T removePlugin(String pluginName)
T
- the inferred type of the pluginpluginName
- the name associated with the pluginnull
if none is existsboolean hasPlugin(String pluginName)
pluginName
- the name associated with the plugintrue
if a plugin is present, false
otherwise<T> boolean hasPlugin(Class<T> pluginClass)
pluginClass
- type the plugin must match; can be an interface or superclass.true
if a plugin is present, false
otherwiseCopyright © 2017–2018 PlugFace. All rights reserved.