Package net.java.games.util.plugins
Class Plugins
java.lang.Object
net.java.games.util.plugins.Plugins
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
-
Method Summary
Modifier and TypeMethodDescriptionClass[]
get()
This method returns all the Plugins found in the directory passed in at object creation time or any of its sub-directories.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.)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.)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.)
-
Constructor Details
-
Plugins
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
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
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
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
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.
-