/** * Registers a new command with this command manager, which is related to a * connection. The <tt>node</tt> is an unique identifier of that command for * the connection related to this command manager. The <tt>name</tt> is the * human readable name of the command. The <tt>class</tt> is the class of * the command, which must extend {@link LocalCommand} and have a default * constructor. * * @param node the unique identifier of the command. * @param name the human readable name of the command. * @param clazz the class of the command, which must extend {@link LocalCommand}. */ public void registerCommand(String node, String name, final Class<? extends LocalCommand> clazz) { registerCommand(node, name, new LocalCommandFactory() { @Override public LocalCommand getInstance() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { return clazz.getConstructor().newInstance(); } }); }
/** * Registers a new command with this command manager, which is related to a * connection. The <tt>node</tt> is an unique identifier of that command for * the connection related to this command manager. The <tt>name</tt> is the * human readable name of the command. The <tt>class</tt> is the class of * the command, which must extend {@link LocalCommand} and have a default * constructor. * * @param node the unique identifier of the command. * @param name the human readable name of the command. * @param clazz the class of the command, which must extend {@link LocalCommand}. */ public void registerCommand(String node, String name, final Class clazz) { registerCommand(node, name, new LocalCommandFactory() { public LocalCommand getInstance() throws InstantiationException, IllegalAccessException { return (LocalCommand)clazz.newInstance(); } }); }
/** * Registers a new command with this command manager, which is related to a * connection. The <tt>node</tt> is an unique identifier of that command for * the connection related to this command manager. The <tt>name</tt> is the * human readable name of the command. The <tt>class</tt> is the class of * the command, which must extend {@link LocalCommand} and have a default * constructor. * * @param node the unique identifier of the command. * @param name the human readable name of the command. * @param clazz the class of the command, which must extend {@link LocalCommand}. */ public void registerCommand(String node, String name, final Class clazz) { registerCommand(node, name, new LocalCommandFactory() { public LocalCommand getInstance() throws InstantiationException, IllegalAccessException { return (LocalCommand)clazz.newInstance(); } }); }
/** * Registers a new command with this command manager, which is related to a * connection. The <tt>node</tt> is an unique identifier of that command for * the connection related to this command manager. The <tt>name</tt> is the * human readable name of the command. The <tt>class</tt> is the class of * the command, which must extend {@link LocalCommand} and have a default * constructor. * * @param node the unique identifier of the command. * @param name the human readable name of the command. * @param clazz the class of the command, which must extend {@link LocalCommand}. */ public void registerCommand(String node, String name, final Class<? extends LocalCommand> clazz) { registerCommand(node, name, new LocalCommandFactory() { public LocalCommand getInstance() throws InstantiationException, IllegalAccessException { return clazz.newInstance(); } }); }