T
- Default constructible type or interface all plugins will derive
from or implementpublic final class Plugins<T> extends Object
Constructor and Description |
---|
Plugins(Class<T> baseClass)
Create an empty plugin list.
|
Modifier and Type | Method and Description |
---|---|
T |
createObject(String name)
Create an object from the specified type name.
|
String |
generateUniqueName(String prefix)
Generate a unique plugin type name which has not yet been registered.
|
boolean |
hasType(String name)
Check this plugin list for the presence of the specified type name
|
boolean |
registerPlugin(String name,
Class<? extends T> pluginClass)
Define a new plugin type from an existing class.
|
boolean |
registerPlugin(String name,
String sourceCode)
Define a new plugin type from java source code.
|
public T createObject(String name)
null
is returned.name
- plugin type namenull
if not found or invalidpublic boolean hasType(String name)
name
- plugin type nametrue
if this name has been registered,
false
otherwisepublic String generateUniqueName(String prefix)
prefix
- a prefix to be used in generating the unique namepublic boolean registerPlugin(String name, String sourceCode)
name
- plugin type namesourceCode
- Java source code definition for the plugintrue
if the code compiled and registered
successfully, false
otherwisepublic boolean registerPlugin(String name, Class<? extends T> pluginClass)
name
- plugin type namepluginClass
- class object for the plugin classtrue
if the plugin registered successfully,
false
otherwiseCopyright © 2017. All rights reserved.