/** * Build a list of commands from methods specially annotated with {@link Command} * (and other relevant annotations) and register them all with the given * {@link Dispatcher}. * * @param dispatcher the dispatcher to register commands with * @param object the object contain the methods * @throws ParametricException thrown if the commands cannot be registered */ public void registerMethodsAsCommands(Dispatcher dispatcher, Object object) throws ParametricException { for (Method method : object.getClass().getDeclaredMethods()) { Command definition = method.getAnnotation(Command.class); if (definition != null) { CommandCallable callable = build(object, method, definition); dispatcher.registerCommand(callable, definition.aliases()); } } }