Package net.java.games.util.plugins
Class Plugins
- java.lang.Object
-
- net.java.games.util.plugins.Plugins
-
public class Plugins extends java.lang.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(java.io.File pluginRoot)
Creates a new instance of Plugins
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class[]
get()
This method returns all the Plugins found in the directory passed in at object creation time or any of its sub-directories.java.lang.Class[]
getExtends(java.lang.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.)java.lang.Class[]
getImplementsAll(java.lang.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.)java.lang.Class[]
getImplementsAny(java.lang.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.)
-
-
-
Method Detail
-
get
public java.lang.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 java.lang.Class[] getImplementsAny(java.lang.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 java.lang.Class[] getImplementsAll(java.lang.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 java.lang.Class[] getExtends(java.lang.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.
-
-