throws InvalidPluginException {
Preconditions.checkState(command != null, "pluginName must be provided");
if (Command.class.isAssignableFrom(type)) {
Class<Command> old = commands.get(export.value());
if (old != null) {
throw new InvalidPluginException(String.format(
"@Export(\"%s\") has duplicate bindings:\n %s\n %s",
export.value(), old.getName(), type.getName()));
}
commands.put(export.value(), (Class<Command>) type);
} else {
throw new InvalidPluginException(String.format(
"Class %s with @Export(\"%s\") must extend %s or implement %s",
type.getName(), export.value(),
SshCommand.class.getName(), Command.class.getName()));
}
}