public static class CommandLineParser.FlagArg extends CommandLineParser.Argument
flag
field which indicates the flag definition
that provided the rules for parsing and producing this FlagArg object.
Some flags have parameters (which can be optional, required, or forbidden/not allowed).
If a parameter value is encountered during parsing, it is stored in the
valueText
field, which is null
in Flags for which no parameter value
was encountered.Modifier and Type | Field and Description |
---|---|
CommandLineParser.FlagDef |
flag
The Flag associated with this Argument, which specifies the name (and aliases) of the
flag as well as the rules used to parse it.
|
java.lang.String |
flagText
Gets the actual flag name from the command-line, without any parameter value or separator that
might have been present.
|
java.lang.Object |
parsedValue
Gets the value of this flag once it has been converted
to the type specified in the associated Flag
|
java.lang.String |
valueText
Gets the value of this flag, if one was specified, or null otherwise.
|
fullText, position
Constructor and Description |
---|
FlagArg(java.lang.String fullText,
int position,
CommandLineParser.FlagDef flag,
java.lang.String flagText,
java.lang.String valueText,
java.lang.Object value) |
public final CommandLineParser.FlagDef flag
public final java.lang.String flagText
When a FlagArg is parsed, the flag name (e.g. "-f" ) is used to associate it with a FlagDef. From that point on, the FlagArg can be retrieved using the FlagDef name (e.g. "file") or any of its aliases. Usually the actual flag name (-f vs -file) is not relevant, but the name is stored in case some implementation requires it.
public final java.lang.Object parsedValue
public final java.lang.String valueText
public FlagArg(java.lang.String fullText, int position, CommandLineParser.FlagDef flag, java.lang.String flagText, java.lang.String valueText, java.lang.Object value)