Class Plugins

java.lang.Object
net.java.games.util.plugins.Plugins

public class Plugins extends Object
This is the application interface to the Plugin system. One Plugins object should be created for each plug-in directory tree root. On creation the Plugins object will scan its assigned directory tree and examine all Jar files in that tree to see if they qualify as Plug-ins. The Plugin classes may then be retrived from the Plugins object by calling the appropriate get function (see below). If a plugin requires a native code library, that library must be present in the same directory as the plugin Jar file UNLESS the property "net.java.games.util.plugins.nolocalnative" is set. In that case it will fall abck to the VM or environment's default way of finding native libraries. (This is n ecessary for Java Web Start apps.)
  • Constructor Summary

    Constructors
    Constructor
    Description
    Plugins(File pluginRoot)
    Creates a new instance of Plugins
  • Method Summary

    Modifier and Type
    Method
    Description
    get()
    This method returns all the Plugins found in the directory passed in at object creation time or any of its sub-directories.
    getExtends(Class superclass)
    This method returns a sub-list of all the found Plugin classes that extend the passed in Class (either directly or through inheritance.)
    getImplementsAll(Class[] interfaces)
    This method returns a sub-list of all the found Plugin classes that implement all of the passed in set of Interfaces (either directly or through inheritance.)
    getImplementsAny(Class[] interfaces)
    This method returns a sub-list of all the found Plugin classes that implement any of the passed in set of Interfaces (either directly or through inheritance.)

    Methods inherited from class java.lang.Object

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

    • Plugins

      public Plugins(File pluginRoot) throws IOException
      Creates a new instance of Plugins
      Parameters:
      pluginRoot - The root od the directory tree to scan for Jars
      Throws:
      IOException - containing plugins.
  • Method Details

    • get

      public Class[] get()
      This method returns all the Plugins found in the directory passed in at object creation time or any of its sub-directories.
      Returns:
      An array of Plugin objects
    • getImplementsAny

      public Class[] getImplementsAny(Class[] interfaces)
      This method returns a sub-list of all the found Plugin classes that implement any of the passed in set of Interfaces (either directly or through inheritance.)
      Parameters:
      interfaces - A set of interfaces to match against the interfaces implemented by the plugin classes.
      Returns:
      The list of plugin classes that implement at least one member of the passed in set of interfaces.
    • getImplementsAll

      public Class[] getImplementsAll(Class[] interfaces)
      This method returns a sub-list of all the found Plugin classes that implement all of the passed in set of Interfaces (either directly or through inheritance.)
      Parameters:
      interfaces - A set of interfaces to match against the interfaces implemented by the plugin classes.
      Returns:
      The list of plugin classes that implement at least one member of the passed in set of interfaces.
    • getExtends

      public Class[] getExtends(Class superclass)
      This method returns a sub-list of all the found Plugin classes that extend the passed in Class (either directly or through inheritance.)
      Parameters:
      superclass - The class to match.
      Returns:
      The list of plugin classes that extend the passed in class.