|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectse.hirt.plugin.PluginLoader
public class PluginLoader
Utility class for finding and instantiating implementors and/or subclasses of a class in a set of specified directories and/or JAR files. Since we may want to separate the search URL's for different plugins and minimize interference between sets of plugins, the factory methods is used to create an new plugin loader.
Field Summary | |
---|---|
static java.lang.String |
CLASS_SUFFIX
The suffix for classes. |
static java.lang.String |
JAR_SUFFIX
The suffix for JAR files. |
Method Summary | ||
---|---|---|
|
createPlugins(java.lang.Class<T> clazz)
Convenience function using the default constructor, to create instances of either: 1. |
|
java.util.Set<java.lang.Class> |
getImplementorsOf(java.lang.Class<?> myInterface)
|
|
java.util.Set<java.lang.Class> |
getSubclassesOf(java.lang.Class<?> myClass)
|
|
java.net.URL[] |
getURLs()
|
|
void |
rescan()
Rescans all files and directories and resets all caches. |
|
void |
setURLs(java.net.URL[] urls)
Sets the URL's to search for classes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLASS_SUFFIX
public static final java.lang.String JAR_SUFFIX
Method Detail |
---|
public void setURLs(java.net.URL[] urls)
urls
- the URLS to search for classes.public java.net.URL[] getURLs()
public java.util.Set<java.lang.Class> getSubclassesOf(java.lang.Class<?> myClass)
myClass
- the class object of the class to retrieve the subclasses for.
May not be an interface.
public java.util.Set<java.lang.Class> getImplementorsOf(java.lang.Class<?> myInterface)
myInterface
- the class of the interface to retrieve the implementors for.
This class must be a valid interface!
public void rescan()
public <T> java.util.Set<T> createPlugins(java.lang.Class<T> clazz) throws java.lang.InstantiationException, java.lang.IllegalAccessException
T
- clazz
- the class for which to find classes to instantiate.
java.lang.IllegalAccessException
java.lang.InstantiationException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |