com.townleyenterprises.command
Class DefaultCommandListener

java.lang.Object
  extended bycom.townleyenterprises.command.AbstractCommandListener
      extended bycom.townleyenterprises.command.DefaultCommandListener
All Implemented Interfaces:
CommandListener

public class DefaultCommandListener
extends AbstractCommandListener

This class allows boilerplate nested classes to be elimitated by providing all of the things supplied by the CommandListener interface as arguments to the constructor.

Since:
2.0
Version:
$Id: DefaultCommandListener.java,v 1.1 2004/07/30 16:20:03 atownley Exp $
Author:
Andrew S. Townley

Constructor Summary
DefaultCommandListener(java.lang.String desc, CommandOption[] opts)
          The constructor is used to supply the arguments for the listener.
 
Method Summary
 java.lang.String getDescription()
          This method is used to retrieve the description of the command listener's options when printing the help message.
 CommandOption[] getOptions()
          This method is called by the CommandParser to determine all of the arguments that should be handled by the listener.
 
Methods inherited from class com.townleyenterprises.command.AbstractCommandListener
optionMatched
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCommandListener

public DefaultCommandListener(java.lang.String desc,
                              CommandOption[] opts)
The constructor is used to supply the arguments for the listener.

Parameters:
desc - the description
opts - the options
Method Detail

getDescription

public java.lang.String getDescription()
This method is used to retrieve the description of the command listener's options when printing the help message. Usually it is the name of the application or subsystem.

Specified by:
getDescription in interface CommandListener
Specified by:
getDescription in class AbstractCommandListener

getOptions

public CommandOption[] getOptions()
This method is called by the CommandParser to determine all of the arguments that should be handled by the listener.

Specified by:
getOptions in interface CommandListener
Specified by:
getOptions in class AbstractCommandListener
Returns:
an array of CommandOption arguments. In the case where no arguments are specified (why would you bother?), a zero-length array should be returned.


Copyright © 2002-2004, Andrew S. Townley and Townley Enterprises. All Rights Reserved.
This project is hosted on http://te-code.sourceforge.net.