Package de.osshangar.plugin
Class Plugin<T,C extends Class<T>>
java.lang.Object
de.osshangar.plugin.Plugin<T,C>
- Type Parameters:
T- type of the object createdC- the interface class that the plugin has to implement
This class loads the plugins
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionload(JarInputStream jarInputStream) This loads the plugin from the provided JarInputStream.load(JarInputStream jarInputStream, Arguments constructorArguments) This loads the plugin from the provided JarInputStream and provides the given arguments to its constructor
-
Constructor Details
-
Plugin
public Plugin()
-
-
Method Details
-
load
public T load(JarInputStream jarInputStream) throws FileFormatException, IOException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException This loads the plugin from the provided JarInputStream.- Parameters:
jarInputStream- The input stream to a JAR package to load the plugin from- Returns:
- The instantiated plugin instance
- Throws:
FileFormatException- when the structure of the plugin JAR is wrongIOException- when an I/O operation failsClassNotFoundException- when the PluginClassLoader does not find a requested classInvocationTargetException- when the provided constructor arguments does not match the signature of the requested constructorNoSuchMethodException- when then plugin does not have a constructor that matches the requested signatureInstantiationException- when the class of the plugin which implements the required plugin interface is an abstract classIllegalAccessException- when the requested constructor of the plugin is inaccessible due to an enforced Java language access control
-
load
public T load(JarInputStream jarInputStream, Arguments constructorArguments) throws FileFormatException, IOException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException This loads the plugin from the provided JarInputStream and provides the given arguments to its constructor- Parameters:
jarInputStream- The input stream to a JAR package to load the plugin fromconstructorArguments- The arguments to be provided to the constructor of the plugin on its instantiation- Returns:
- The instance of the loaded plugin
- Throws:
FileFormatException- when the structure of the plugin JAR is wrongIOException- when an I/O operation failsClassNotFoundException- when the PluginClassLoader does not find a requested classInvocationTargetException- when the provided constructor arguments does not match the signature of the requested constructorNoSuchMethodException- when then plugin does not have a constructor that matches the requested signatureInstantiationException- when the class of the plugin which implements the required plugin interface is an abstract classIllegalAccessException- when the requested constructor of the plugin is inaccessible due to an enforced Java language access control
-