|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.util.PluginUtil
public final class PluginUtil
A plugin maps one or more implementations to an interface or abstract class via a properties file whose suffix is "plugin". When there is more than one implementation, one is marked as a default.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
private static String |
DEFAULT
The string for default implementations |
static String |
EXTENSION_PLUGIN
Extension for properties files |
private static Logger |
log
The log stream |
Constructor Summary | |
---|---|
private |
PluginUtil()
Prevent instantiation |
Method Summary | |
---|---|
static Object |
getImplementation(Class clazz)
Get and instantiate the preferred implementor of some interface or abstract class. |
static Class |
getImplementor(Class clazz)
Get the preferred implementor of some interface or abstract class. |
static Class[] |
getImplementors(Class clazz)
Get the known implementors of some interface or abstract class. |
static Map |
getImplementorsMap(Class clazz)
Get a map of known implementors of some interface or abstract class. |
static Properties |
getPlugin(Class clazz)
Get and load a plugin file by looking it up as a resource. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String EXTENSION_PLUGIN
private static final String DEFAULT
private static final Logger log
Constructor Detail |
---|
private PluginUtil()
Method Detail |
---|
public static Class[] getImplementors(Class clazz)
clazz
- The class or interface to find implementors of.
public static Map getImplementorsMap(Class clazz)
clazz
- The class or interface to find implementors of.
getImplementors(Class)
public static Class getImplementor(Class clazz) throws IOException, ClassNotFoundException, ClassCastException
clazz
- The class or interface to find an implementation of.
MalformedURLException
- if the plugin file can not be found
IOException
- if there is a problem reading the found file
ClassNotFoundException
- if the read contents are not found
ClassCastException
- if the read contents are not validgetImplementors(Class)
public static Object getImplementation(Class clazz) throws MalformedURLException, ClassCastException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
clazz
- The class or interface to find an implementation of.
MalformedURLException
- if the plugin file can not be found
IOException
- if there is a problem reading the found file
ClassNotFoundException
- if the read contents are not found
ClassCastException
- if the read contents are not valid
InstantiationException
- if the new object can not be instantiated
IllegalAccessException
- if the new object can not be instantiatedgetImplementors(Class)
public static Properties getPlugin(Class clazz) throws IOException
clazz
- The name of the desired resource
IOException
- if the resource can not be loaded
MissingResourceException
- if the resource can not be found
|
Copyright ยจ 2003-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |