info.rolandkrueger.roklib.cli
Class ConsoleCommandObject

java.lang.Object
  extended by info.rolandkrueger.roklib.cli.AbstractCommandObject
      extended by info.rolandkrueger.roklib.cli.ConsoleCommandObject

public abstract class ConsoleCommandObject
extends AbstractCommandObject

Base class for all command objects that are used with the ConsoleThread. The command's concrete functionality is implemented by overriding the run() method.
ConsoleCommandObject contains three strings: the command's name that is used by the user on the console, a short description of the command that is used by the 'help' command to show a brief overview of the available commands, and a long description that can be used to describe the command's functioning in more depth.

Author:
Roland Krueger

Field Summary
private  String mLongDescription
           
protected  OutputStream mOutputStream
           
private  String mShortDescription
           
 
Fields inherited from class info.rolandkrueger.roklib.cli.AbstractCommandObject
mName
 
Constructor Summary
ConsoleCommandObject(String name, String shortDescription, String longDescription)
          Constructs a new command with the specified name and descriptions.
ConsoleCommandObject(String name, String shortDescription, String longDescription, OutputStream output)
          Constructs a new command with the specified name and descriptions.
 
Method Summary
 String getLongDescription()
          Returns the long description for this command object.
 OutputStream getOutputStream()
          Returns the output stream for this command object.
 String getShortDescription()
          Returns the short description for this command object.
 void setOutputStream(OutputStream stream)
          Sets the output stream for a command object.
 
Methods inherited from class info.rolandkrueger.roklib.cli.AbstractCommandObject
getName, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mShortDescription

private final String mShortDescription

mLongDescription

private final String mLongDescription

mOutputStream

protected OutputStream mOutputStream
Constructor Detail

ConsoleCommandObject

public ConsoleCommandObject(String name,
                            String shortDescription,
                            String longDescription)
Constructs a new command with the specified name and descriptions.

Parameters:
name - The name of the command.
shortDescription - A short description of the command.
longDescription - A more detailed description of the command's functioning.

ConsoleCommandObject

public ConsoleCommandObject(String name,
                            String shortDescription,
                            String longDescription,
                            OutputStream output)
Constructs a new command with the specified name and descriptions.

Parameters:
name - The name of the command.
shortDescription - A short description of the command.
longDescription - A more detailed description of the command's functioning.
output - An output stream that can be used to write the command's output to.
Method Detail

getOutputStream

public OutputStream getOutputStream()
Returns the output stream for this command object. This stream can be used by command objects to print out messages.

Returns:
the output stream for this command object

setOutputStream

public void setOutputStream(OutputStream stream)
Sets the output stream for a command object.

Parameters:
stream - the output stream for the command object

getShortDescription

public String getShortDescription()
Returns the short description for this command object.

Returns:
the short description for this command object.

getLongDescription

public String getLongDescription()
Returns the long description for this command object.

Returns:
the long description for this command object.


Copyright © 2007-2011. All Rights Reserved.