public final class PluginUtil extends Object
The GNU Lesser General Public License for details.| Modifier and Type | Field and Description |
|---|---|
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
|
| Modifier | Constructor and Description |
|---|---|
private |
PluginUtil()
Prevent instantiation
|
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
getImplementation(Class<T> clazz)
Get and instantiate the preferred implementor of some interface or
abstract class.
|
static <T> Class<T> |
getImplementor(Class<T> clazz)
Get the preferred implementor of some interface or abstract class.
|
static <T> Class<T>[] |
getImplementors(Class<T> clazz)
Get the known implementors of some interface or abstract class.
|
static <T> Map<String,Class<T>> |
getImplementorsMap(Class<T> clazz)
Get a map of known implementors of some interface or abstract class.
|
static <T> PropertyMap |
getPlugin(Class<T> clazz)
Get and load a plugin file by looking it up as a resource.
|
public static final String EXTENSION_PLUGIN
private static final String DEFAULT
private static final org.slf4j.Logger log
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 foundIOException - if there is a problem reading the found fileClassNotFoundException - if the read contents are not foundClassCastException - 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 foundIOException - if there is a problem reading the found fileClassNotFoundException - if the read contents are not foundClassCastException - if the read contents are not validInstantiationException - if the new object can not be instantiatedIllegalAccessException - 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 resourceIOException - if the resource can not be loadedMissingResourceException - if the resource can not be found