com.townleyenterprises.command
Class DelimitedCommandOption

java.lang.Object
  extended bycom.townleyenterprises.command.CommandOption
      extended bycom.townleyenterprises.command.RepeatableCommandOption
          extended bycom.townleyenterprises.command.DelimitedCommandOption

public class DelimitedCommandOption
extends RepeatableCommandOption

This class provides support for multi-valued options which are specified using delmited values. Examples of options of this form are:

 	-X one,two,three
 	--value=1,2,3,4
 	--eggs green
 

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

Constructor Summary
DelimitedCommandOption(java.lang.String longName, char shortName, java.lang.String argHelp, java.lang.String argDesc)
          The constructor takes almost all of the parent class's arguments, but the assumption is that if it was a regular command option, it wouldn't be necessary to recognize it more than once.
DelimitedCommandOption(java.lang.String longName, char shortName, java.lang.String argHelp, java.lang.String argDesc, boolean show, java.lang.String def, java.lang.String delim)
          This version of the constructor allows specifying if the argument is to be shown to the user and if the argument has a default value if it is not specified on the command line.
 
Method Summary
protected  void addArg(java.lang.String arg)
          This method will parse the argument as it's added and ensure that all of the values get added to the parent class's list.
 
Methods inherited from class com.townleyenterprises.command.RepeatableCommandOption
getArg, getArgs, optionMatched, reset
 
Methods inherited from class com.townleyenterprises.command.CommandOption
execute, getArgumentDefault, getArgValue, getDescription, getExpectsArgument, getHelp, getLongName, getMatched, getName, getShortName, getShowArgInHelp, hashCode, parseOption, parseOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelimitedCommandOption

public DelimitedCommandOption(java.lang.String longName,
                              char shortName,
                              java.lang.String argHelp,
                              java.lang.String argDesc)
The constructor takes almost all of the parent class's arguments, but the assumption is that if it was a regular command option, it wouldn't be necessary to recognize it more than once. Therefore, this class assumes that there will be an argument each time it is matched by the command parser. The default delmiter is the comma (',').

Parameters:
longName - the long name to be checked
shortName - the short, single character name
argHelp - the help string for the argument
argDesc - the long description of what the argument does

DelimitedCommandOption

public DelimitedCommandOption(java.lang.String longName,
                              char shortName,
                              java.lang.String argHelp,
                              java.lang.String argDesc,
                              boolean show,
                              java.lang.String def,
                              java.lang.String delim)
This version of the constructor allows specifying if the argument is to be shown to the user and if the argument has a default value if it is not specified on the command line.

Parameters:
longName - the long name to be checked
shortName - the short, single character name
argHelp - the help string for the argument
argDesc - the long description of what the argument does
show - true if should be shown in autohelp
def - the default value (informational only) of the argument if it is not specified.
delim - the delimiter to be used to seperate the option values.
Method Detail

addArg

protected void addArg(java.lang.String arg)
This method will parse the argument as it's added and ensure that all of the values get added to the parent class's list.

Overrides:
addArg in class RepeatableCommandOption
Parameters:
arg - the argument to be added


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