Search in sources :

Example 1 with BaseCommand

use of com.ibm.java.diagnostics.utils.commands.BaseCommand in project openj9 by eclipse.

the class PluginConfig method newInstance.

public ICommand newInstance(ClassLoader loader) throws CommandException {
    ClassInfo info = entry.getData();
    try {
        Class<?> clazz = Class.forName(info.getClassname(), true, loader);
        Object instance = clazz.newInstance();
        if (instance instanceof BaseCommand) {
            ((BaseCommand) instance).setConfig(this);
        }
        return (ICommand) instance;
    } catch (Throwable e) {
        // have to use Throwable here to catch things like class not found errors
        t = e;
        throw new CommandException("Failed to create a new instance of command " + info.getClassname(), e);
    }
}
Also used : BaseCommand(com.ibm.java.diagnostics.utils.commands.BaseCommand) ICommand(com.ibm.java.diagnostics.utils.commands.ICommand) CommandException(com.ibm.java.diagnostics.utils.commands.CommandException)

Aggregations

BaseCommand (com.ibm.java.diagnostics.utils.commands.BaseCommand)1 CommandException (com.ibm.java.diagnostics.utils.commands.CommandException)1 ICommand (com.ibm.java.diagnostics.utils.commands.ICommand)1