BioLegato 0.6.2

org.biolegato.core.plugins
Class PluginWrapper

java.lang.Object
  extended by org.biolegato.core.plugins.PluginWrapper

public class PluginWrapper
extends java.lang.Object

This class is used to wrap plugins. This makes accessing the class represented by the plugin easier.

Author:
Graham Alvare, Brian Fristensky

Constructor Summary
PluginWrapper(java.lang.String pluginName, java.lang.Class<?> pluginClass)
          Creates a new instance of the plugin wrapper class.
 
Method Summary
 java.lang.Object create()
          Creates a new object the plugin class.
 java.lang.Object create(java.lang.Class[] classes, java.lang.Object[] data)
          Creates a new object the wrapped plugin class (returns null if unsuccessful).
 java.lang.String getName()
          Returns the class's name.
 boolean isA(java.lang.Class<?> test)
          Used to test instanceof for the plugin class.
 java.lang.Object smethod(java.lang.String name)
          Invokes a static method from the plugin.
 java.lang.Object smethod(java.lang.String name, java.lang.Class[] classes, java.lang.Object[] parameters)
          Invokes a static method from the plugin (returns null if not successful).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginWrapper

public PluginWrapper(java.lang.String pluginName,
                     java.lang.Class<?> pluginClass)
Creates a new instance of the plugin wrapper class.

Parameters:
pluginName - the name of the plugin
pluginClass - the instance of the plugin
Method Detail

create

public java.lang.Object create()
Creates a new object the plugin class. Alias for create(new Class[]{}, new Object[]{});

Returns:
the instance of the object of the type of plugin

create

public java.lang.Object create(java.lang.Class[] classes,
                               java.lang.Object[] data)
Creates a new object the wrapped plugin class (returns null if unsuccessful).

Parameters:
classes - the class types to use when searching for the constructor
data - the data to pass to the plugin's class constructor
Returns:
the instance of the object of the type of plugin

smethod

public java.lang.Object smethod(java.lang.String name)
Invokes a static method from the plugin. Alias for: smethod(name, new Class[]{}, new Object[]{});

Parameters:
name - the name of the method
Returns:
the result of the method

smethod

public java.lang.Object smethod(java.lang.String name,
                                java.lang.Class[] classes,
                                java.lang.Object[] parameters)
Invokes a static method from the plugin (returns null if not successful).

Parameters:
name - the name of the method
classes - the classes for the parameters
parameters - the parameters to use
Returns:
the result of the method

isA

public boolean isA(java.lang.Class<?> test)
Used to test instanceof for the plugin class.

Parameters:
test - the class to test instanciation of
Returns:
the result of the test

getName

public java.lang.String getName()
Returns the class's name.

Returns:
the name of the plugin

BioLegato 0.6.2

Copyright © 2008-2009 University of Manitoba.