ar.com.ktulu.util.command
Interface Command

All Known Implementing Classes:
CmdClient, CmdDefine, CmdHelp, CmdMatch, CmdOption, CmdQuit, CmdShow, CmdStatus

public interface Command

Command pattern. There are several methods depending on what information the command needs.
The way the method has of telling there has been an error is by throwing a CommandException. This is by far not the best solution, but the best I could think of. The main problem with this approach is that code that call commands that don't throw exceptions are obliged to surround the command call with a try/catch pair.

Author:
Luis Parravicini
See Also:
Command Pattern

Method Summary
 void execute()
          Executes the command without passing any arguments to it.
 void execute(Context ctx)
          Executes the command only a context to it.
 void execute(Context ctx, java.lang.String[] args)
          Executes the command with a context and an array of strings as arguments.
 void execute(java.lang.String[] args)
          Executes the command passing an array of strings as arguments.
 java.lang.String getDescription()
          Returns a brief description of the command.
 

Method Detail

execute

public void execute()
             throws CommandException
Executes the command without passing any arguments to it.

CommandException

execute

public void execute(java.lang.String[] args)
             throws CommandException
Executes the command passing an array of strings as arguments.

CommandException

execute

public void execute(Context ctx)
             throws CommandException
Executes the command only a context to it.

CommandException

execute

public void execute(Context ctx,
                    java.lang.String[] args)
             throws CommandException
Executes the command with a context and an array of strings as arguments.

CommandException

getDescription

public java.lang.String getDescription()
Returns a brief description of the command.