ikrs.util
Interface Command

All Known Implementing Classes:
AbstractCommand, CommandHelp, CommandLicense, CommandListen, CommandLogLevel, CommandQuit, CommandStatus, CommandUnlisten, CommandVersion, CommandWarranty, DefaultCommand, ModuleCommand, YuccaCommand

public interface Command

This interface should be used to implement the inner representation of parsed commands.


Method Summary
 int execute()
          This is the final execution method.
 java.lang.String getName()
          This is the basic command name, such as "ls", "wget" or "git".
 BasicType getParamAt(int index)
          Get the param at the given index.
 int getParamCount()
          Get the number of params this command has.
 java.lang.StringBuffer toString(java.lang.StringBuffer b)
          Convert this command into a parseable string.
 

Method Detail

getName

java.lang.String getName()
This is the basic command name, such as "ls", "wget" or "git".


getParamCount

int getParamCount()
Get the number of params this command has. The command name itself does not belong to the param list.


getParamAt

BasicType getParamAt(int index)
                     throws java.lang.IndexOutOfBoundsException
Get the param at the given index. The param indices range from 0 to getParamCount()-1.

Parameters:
index - the param index.
Throws:
java.lang.IndexOutOfBoundsException

toString

java.lang.StringBuffer toString(java.lang.StringBuffer b)
Convert this command into a parseable string. The string will be stored in the given string buffer.

Parameters:
b - The stringbuffer to append this command to.

execute

int execute()
This is the final execution method. Note that this method does _not_ throw any exceptions! It up to a stored internal command handler to handle exceptions.

Returns:
a return code that indicates the execution result. It depends on the context what the exact meaning of the return code is, but usually the value 0 (zero) implies success.