com.townleyenterprises.command
Class DelimitedCommandOption
java.lang.Object
com.townleyenterprises.command.CommandOption
com.townleyenterprises.command.RepeatableCommandOption
com.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.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 |
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 checkedshortName
- the short, single character nameargHelp
- the help string for the argumentargDesc
- 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 checkedshortName
- the short, single character nameargHelp
- the help string for the argumentargDesc
- the long description of what the argument
doesshow
- true if should be shown in autohelpdef
- the default value (informational only) of
the argument if it is not specified.delim
- the delimiter to be used to seperate the
option values.
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.