public class StringArgSwitch extends AbstractSwitch
description, longForm, shortForm| Constructor and Description |
|---|
StringArgSwitch(java.lang.Character shortForm,
java.lang.String longForm,
java.lang.String argName,
java.lang.String defaultArgument,
java.lang.String description) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
consumeArgument(java.lang.String arg)
Read further arguments from the command line.
|
void |
found(char shortSwitch)
This switch appears in the command line in the given short form.
|
void |
found(java.lang.String longSwitch)
This switch appears in the command line in the given long form.
|
java.lang.String |
getAppearance()
Get the appearance of this switch or argument on the command line.
|
java.lang.String |
getArgument()
Get the argument.
|
boolean |
isVarLength()
Does this argument or switch have a variable length?
|
boolean |
needsArguments()
Does this switch require arguments?
|
getDescription, getLongForms, getShortFormsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisOptional, isSwitchpublic StringArgSwitch(@NotNull java.lang.Character shortForm, @NotNull java.lang.String longForm, @NotNull java.lang.String argName, @NotNull java.lang.String defaultArgument, @NotNull java.lang.String description)
shortForm - short form of the switchlongForm - long form of the switchargName - name used for the argumentdefaultArgument - default value for the argumentdescription - description of the switchpublic boolean isVarLength()
SwitchOrArgumenttrue: this argument or switch consumes the remaining items in the command linefalse: this argument or switch just consumes 1 item (for arguments) or 2 items (for switches) from the command linepublic void found(char shortSwitch)
shortSwitch - short form in which this switch appearedpublic void found(@NotNull java.lang.String longSwitch)
longSwitch - long form@NotNull public java.lang.String getAppearance()
public boolean needsArguments()
consumeArgument(String)
method will be called.
The default implementation returns false, so always both
this method and the consumeArgument(String) method need to
be overridden.true if this switch requires argumentsfalse if this switch does not require argumentsconsumeArgument(String)public boolean consumeArgument(@NotNull java.lang.String arg)
arg - argumentneedsArguments()@NotNull public java.lang.String getArgument()