|
||||||||||
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.
The GNU Lesser General Public License for details.
Field Summary | |
---|---|
private static String |
DEFAULT
The string for default implementations |
static String |
EXTENSION_PLUGIN
Extension for properties files |
private static org.slf4j.Logger |
log
The log stream |
Constructor Summary | |
---|---|
private |
PluginUtil()
Prevent instantiation |
Method Summary | ||
---|---|---|
static
|
getImplementation(Class<T> clazz)
Get and instantiate the preferred implementor of some interface or abstract class. |
|
static
|
getImplementor(Class<T> clazz)
Get the preferred implementor of some interface or abstract class. |
|
static
|
getImplementors(Class<T> clazz)
Get the known implementors of some interface or abstract class. |
|
static
|
getImplementorsMap(Class<T> clazz)
Get a map of known implementors of some interface or abstract class. |
|
static
|
getPlugin(Class<T> 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 org.slf4j.Logger log
Constructor Detail |
---|
private PluginUtil()
Method Detail |
---|
public static <T> Class<T>[] getImplementors(Class<T> clazz)
T
- the implementor's typeclazz
- The class or interface to find implementors of.
public static <T> Map<String,Class<T>> getImplementorsMap(Class<T> clazz)
T
- the implementor's typeclazz
- The class or interface to find implementors of.
getImplementors(Class)
public static <T> Class<T> getImplementor(Class<T> clazz) throws IOException, ClassNotFoundException, ClassCastException
T
- the implementor's typeclazz
- 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 <T> T getImplementation(Class<T> clazz) throws MalformedURLException, ClassCastException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
T
- the implementor's typeclazz
- 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 <T> PropertyMap getPlugin(Class<T> clazz) throws IOException
T
- the implementor's typeclazz
- The name of the desired resource
IOException
- if the resource can not be loaded
MissingResourceException
- if the resource can not be found
|
Copyright ยจ 2003-2015 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |