com.tobedevoured.command.DefaultDependencyResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Make Java do your bidding by turning any code into an executable
The newest version!
package com.tobedevoured.command;
import org.apache.commons.beanutils.ConstructorUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;
public class DefaultDependencyResolver implements DependencyResolvable {
protected ByYourCommandManager manager;
public void init(Map commandsToRun) {
// NOOP
}
public T getInstance(Class clazz) throws CommandException {
try {
return (T)ConstructorUtils.invokeConstructor(clazz, null);
} catch (NoSuchMethodException e) {
throw new CommandException(e);
} catch (IllegalAccessException e) {
throw new CommandException(e);
} catch (InvocationTargetException e) {
throw new CommandException(e);
} catch (InstantiationException e) {
throw new CommandException(e);
}
}
public void setManager(ByYourCommandManager manager) {
this.manager = manager;
}
}