MaltParser 1.4.1

org.maltparser.core.plugin
Class PluginLoader

java.lang.Object
  extended by org.maltparser.core.plugin.PluginLoader
All Implemented Interfaces:
Iterable<Plugin>

public class PluginLoader
extends Object
implements Iterable<Plugin>

Loads MaltParser plug-ins and makes new instances of classes within these plug-ins.

Since:
1.0
Author:
Johan Hall

Method Summary
 Class<?> getClass(String classname)
          Returns the Class object for the class with the specified name.
static PluginLoader instance()
          Returns a reference to the single instance.
 Iterator<Plugin> iterator()
           
 void loadPlugins(File pluginDirectory)
          Loads plug-ins from one directory
 void loadPlugins(File[] pluginDirectories)
          Loads plug-ins from one or more directories
 Object newInstance(String classname, Class<?>[] argTypes, Object[] args)
          Creates a new instance of a class within one of the plug-ins
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

instance

public static PluginLoader instance()
Returns a reference to the single instance.


loadPlugins

public void loadPlugins(File pluginDirectory)
                 throws MaltChainedException
Loads plug-ins from one directory

Parameters:
pluginDirectory - The directory that contains all plug-ins
Throws:
MaltChainedException

loadPlugins

public void loadPlugins(File[] pluginDirectories)
                 throws MaltChainedException
Loads plug-ins from one or more directories

Parameters:
pluginDirectories - An array of directories that contains all plug-ins
Throws:
MaltChainedException

getClass

public Class<?> getClass(String classname)
Returns the Class object for the class with the specified name.

Parameters:
classname - the fully qualified name of the desired class
Returns:
the Class object for the class with the specified name.

newInstance

public Object newInstance(String classname,
                          Class<?>[] argTypes,
                          Object[] args)
                   throws MaltChainedException
Creates a new instance of a class within one of the plug-ins

Parameters:
classname - The fully qualified name of the desired class
argTypes - An array of classes (fully qualified name) that specify the arguments to the constructor
args - An array of objects that will be the actual parameters to the constructor (the type should corresponds to the argTypes).
Returns:
a reference to the created instance.
Throws:
MaltChainedException

iterator

public Iterator<Plugin> iterator()
Specified by:
iterator in interface Iterable<Plugin>

toString

public String toString()
Overrides:
toString in class Object

MaltParser 1.4.1

Copyright 2007-2010 Johan Hall, Jens Nilsson and Joakim Nivre.