Package pluginloader

Class PluginLoader

java.lang.Object
pluginloader.PluginLoader

public class PluginLoader
extends java.lang.Object
This class loads plugins and instantiates them
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  PluginLoader.LoadingException  
    static class  PluginLoader.WrongFileFormatException  
  • Constructor Summary

    Constructors 
    Constructor Description
    PluginLoader()  
  • Method Summary

    Modifier and Type Method Description
    <OBJECT> OBJECT load​(java.lang.String plugin, java.lang.Class<OBJECT> pluginInterface)
    Compiles a plugin given as a java class in source code form and loads it into the Java Runtime.
    <OBJECT> OBJECT load​(java.util.jar.JarInputStream jarInputStream, java.lang.Class<OBJECT> pluginInterface)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • load

      public <OBJECT> OBJECT load​(java.util.jar.JarInputStream jarInputStream, java.lang.Class<OBJECT> pluginInterface) throws PluginLoader.LoadingException
      Throws:
      PluginLoader.LoadingException
    • load

      public <OBJECT> OBJECT load​(java.lang.String plugin, java.lang.Class<OBJECT> pluginInterface) throws PluginLoader.LoadingException
      Compiles a plugin given as a java class in source code form and loads it into the Java Runtime. It only loads classes that extend the given java class. After successfully loading it, an instance of each found class that extends the given class will be returned to the caller. If a class already exists, it will be updated if its code has changed. If the code has not changed, the loading is skipped and a new instance of the class is returned.
      Type Parameters:
      OBJECT - The type of the object to be returned
      Parameters:
      plugin - The string containing the source code of the plugin class
      pluginInterface - The interface/class the plugin class has to implement/extend
      Returns:
      The new instance of the class
      Throws:
      PluginLoader.LoadingException - When something goes wrong while compiling or loading the class