com.townleyenterprises.command
Class AbstractCommandListener

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

public abstract class AbstractCommandListener
extends java.lang.Object
implements CommandListener

This class is intended to more easily support the implementation of command-line argument handler classes by providing an empty optionMatched method.

Since:
2.0
Version:
$Id: AbstractCommandListener.java,v 1.4 2004/07/28 10:33:58 atownley Exp $
Author:
Andrew S. Townley

Constructor Summary
AbstractCommandListener()
           
 
Method Summary
abstract  java.lang.String getDescription()
          This method is used to retrieve the description of the command listener's options when printing the help message.
abstract  CommandOption[] getOptions()
          This method is called by the CommandParser to determine all of the arguments that should be handled by the listener.
 void optionMatched(CommandOption opt, java.lang.String arg)
          This method is called whenever an arguement registered with the parser is detected in the argument stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCommandListener

public AbstractCommandListener()
Method Detail

getDescription

public abstract 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

getOptions

public abstract 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
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.

optionMatched

public void optionMatched(CommandOption opt,
                          java.lang.String arg)
This method is called whenever an arguement registered with the parser is detected in the argument stream. This implementation is empty and is intended for use in Object-Oriented command-line argument parsing.

Specified by:
optionMatched in interface CommandListener
Parameters:
opt - the CommandOption matched by the parser
arg - the argument (if any) specified for the option


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