Added generics to PluginManager
This commit is contained in:
parent
9ecdf8b4ba
commit
e3497e12a0
@ -18,7 +18,7 @@ public interface PluginManager {
|
|||||||
* @param loader Class name of the PluginLoader to register
|
* @param loader Class name of the PluginLoader to register
|
||||||
* @throws IllegalArgumentException Thrown when the given Class is not a valid PluginLoader
|
* @throws IllegalArgumentException Thrown when the given Class is not a valid PluginLoader
|
||||||
*/
|
*/
|
||||||
public void RegisterInterface(Class loader) throws IllegalArgumentException;
|
public void RegisterInterface(Class<? extends ClassLoader> loader) throws IllegalArgumentException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the given plugin is loaded and returns it when applicable
|
* Checks if the given plugin is loaded and returns it when applicable
|
||||||
|
@ -39,11 +39,11 @@ public final class SimplePluginManager implements PluginManager {
|
|||||||
* @param loader Class name of the PluginLoader to register
|
* @param loader Class name of the PluginLoader to register
|
||||||
* @throws IllegalArgumentException Thrown when the given Class is not a valid PluginLoader
|
* @throws IllegalArgumentException Thrown when the given Class is not a valid PluginLoader
|
||||||
*/
|
*/
|
||||||
public void RegisterInterface(Class loader) throws IllegalArgumentException {
|
public void RegisterInterface(Class<? extends ClassLoader> loader) throws IllegalArgumentException {
|
||||||
PluginLoader instance;
|
PluginLoader instance;
|
||||||
|
|
||||||
if (PluginLoader.class.isAssignableFrom(loader)) {
|
if (PluginLoader.class.isAssignableFrom(loader)) {
|
||||||
Constructor constructor;
|
Constructor<? extends ClassLoader> constructor;
|
||||||
try {
|
try {
|
||||||
constructor = loader.getConstructor(Server.class);
|
constructor = loader.getConstructor(Server.class);
|
||||||
instance = (PluginLoader) constructor.newInstance(server);
|
instance = (PluginLoader) constructor.newInstance(server);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user