|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.townleyenterprises.command.CommandOption com.townleyenterprises.command.RepeatableCommandOption
This class provides the basic support for repeatable command line arguments. This class can be used to allow a given argument to be supplied more than once on the command line.
Constructor Summary | |
RepeatableCommandOption(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. |
|
RepeatableCommandOption(java.lang.String longName,
char shortName,
java.lang.String argHelp,
java.lang.String argDesc,
boolean show,
java.lang.String def)
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 is provided so that any derived classes can append arguments to the list. |
java.lang.String |
getArg()
This method will return the last argument matched by this option rather than the collection of all the arguments. |
java.util.List |
getArgs()
This method returns the arguments which have been matched by this instance. |
void |
optionMatched(java.lang.String arg)
This method calls the parent class's version to ensure that the option behaves consistently with the rest of the system, but it collects each of the arguments so that they may be retrieved via the getArgs method. |
void |
reset()
This method empties the list of all matched arguments in addition to any operations performed by the parent class. |
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 |
public RepeatableCommandOption(java.lang.String longName, char shortName, java.lang.String argHelp, java.lang.String argDesc)
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
doespublic RepeatableCommandOption(java.lang.String longName, char shortName, java.lang.String argHelp, java.lang.String argDesc, boolean show, java.lang.String def)
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.Method Detail |
public java.lang.String getArg()
getArg
in class CommandOption
public void optionMatched(java.lang.String arg)
getArgs
method.
optionMatched
in class CommandOption
arg
- the argument (if expected)public java.util.List getArgs()
public void reset()
reset
in class CommandOption
protected void addArg(java.lang.String arg)
arg
- the argument to be added
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |