public static final class Arguments.Argument
extends java.lang.Object
Argument[] argList = { new Argument("", " argument without key on first position", setmethod) , new Argument("-arg", ":keyed argument", setmethod) , new Argument("-x", ":the help text", setx) , new Argument("", " argument without key on any position", setx) };
#arg
is empty and it is not on the last position, this is a non keyed argument
which is expect on this position in the argument list.
#arg
is not empty, it is the key for the argument. Usual it starts with "-"
but that is not necessary for the algorithm of argument detection. It is only a style of guide
to give arguments. After the argument one of the character '=' or ':' are possible to follow.
But that is not necessary too. If that characters follow, the argument key is taken.
Elsewhere the longest key is detected which is matching. It is possible to request:
"key1value" and "key11value", the longest key detection wins.
#arg
is empty and it is the last Argument[] which is added with MainCmd#addArgument(Argument[])
respectively it is the last entry in MainCmd#argList
, then any argument which does not start
with the given keys are recognized on any position. In this case the distinction between arguments
should be done at user level. For example it may be usual to write "key value key2 value".
Modifier and Type | Field and Description |
---|---|
java.lang.String |
help |
java.lang.String |
option
The option switch used for detect the argument, accessible for help.
|
protected Arguments.SetArgument |
set |
java.lang.String |
val
The value of the string given argument.
|
Constructor and Description |
---|
Argument(java.lang.String option,
java.lang.String help)
Ctor for an instance which holds the argument value, stored as string.
|
Argument(java.lang.String option,
java.lang.String help,
Arguments.SetArgument set)
Ctor with a specific set operation, the argument value us not used here.
|
Argument(java.lang.String option,
java.lang.String value,
java.lang.String help)
Ctor for an instance which holds the argument value, stored as string and given as default.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
toString() |
public java.lang.String val
public final java.lang.String option
public final java.lang.String help
protected final Arguments.SetArgument set
public Argument(java.lang.String option, java.lang.String help)
option
- The option to select this argument, usual "-option", "" for option-less arguments.help
- ":help text", write the dot for proper explanationset
- the operation to set the value.public Argument(java.lang.String option, java.lang.String value, java.lang.String help)
option
- The option to select this argument, usual "-option", "" for option-less arguments.help
- ":help text", write the dot for proper explanationset
- the operation to set the value.public Argument(java.lang.String option, java.lang.String help, Arguments.SetArgument set)
option
- The option to select this argument, usual "-option", "" for option-less arguments.help
- ":help text", write the dot for proper explanationset
- the operation to set the value.