public class PluginLoader extends java.lang.Object implements java.lang.Iterable<Plugin>
Modifier and Type | Method and Description |
---|---|
java.lang.Class<?> |
getClass(java.lang.String classname)
Returns the Class object for the class with the specified name.
|
static PluginLoader |
instance()
Returns a reference to the single instance.
|
java.util.Iterator<Plugin> |
iterator() |
void |
loadPlugins(java.io.File pluginDirectory)
Loads plug-ins from one directory
|
void |
loadPlugins(java.io.File[] pluginDirectories)
Loads plug-ins from one or more directories
|
java.lang.Object |
newInstance(java.lang.String classname,
java.lang.Class<?>[] argTypes,
java.lang.Object[] args)
Creates a new instance of a class within one of the plug-ins
|
java.lang.String |
toString() |
public static PluginLoader instance()
public void loadPlugins(java.io.File pluginDirectory) throws MaltChainedException
pluginDirectory
- The directory that contains all plug-insMaltChainedException
public void loadPlugins(java.io.File[] pluginDirectories) throws MaltChainedException
pluginDirectories
- An array of directories that contains all plug-insMaltChainedException
public java.lang.Class<?> getClass(java.lang.String classname)
classname
- the fully qualified name of the desired classpublic java.lang.Object newInstance(java.lang.String classname, java.lang.Class<?>[] argTypes, java.lang.Object[] args) throws MaltChainedException
classname
- The fully qualified name of the desired classargTypes
- An array of classes (fully qualified name) that specify the arguments to the constructorargs
- An array of objects that will be the actual parameters to the constructor (the type should corresponds to the argTypes).MaltChainedException
public java.util.Iterator<Plugin> iterator()
iterator
in interface java.lang.Iterable<Plugin>
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.