class CommandLineArgs
extends java.lang.Object
SimpleCommandLineArgsParser
Modifier and Type | Field and Description |
---|---|
private java.util.List<java.lang.String> |
nonOptionArgs |
private java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
optionArgs |
Constructor and Description |
---|
CommandLineArgs() |
Modifier and Type | Method and Description |
---|---|
void |
addNonOptionArg(java.lang.String value)
Add the given value to the list of non-option arguments.
|
void |
addOptionArg(java.lang.String optionName,
java.lang.String optionValue)
Add an option argument for the given option name and add the given value to the
list of values associated with this option (of which there may be zero or more).
|
boolean |
containsOption(java.lang.String optionName)
Return whether the option with the given name was present on the command line.
|
java.util.List<java.lang.String> |
getNonOptionArgs()
Return the list of non-option arguments specified on the command line.
|
java.util.Set<java.lang.String> |
getOptionNames()
Return the set of all option arguments present on the command line.
|
java.util.List<java.lang.String> |
getOptionValues(java.lang.String optionName)
Return the list of values associated with the given option.
|
private final java.util.Map<java.lang.String,java.util.List<java.lang.String>> optionArgs
private final java.util.List<java.lang.String> nonOptionArgs
public void addOptionArg(java.lang.String optionName, @Nullable java.lang.String optionValue)
null
, indicating that the option was specified
without an associated value (e.g. "--foo" vs. "--foo=bar").public java.util.Set<java.lang.String> getOptionNames()
public boolean containsOption(java.lang.String optionName)
@Nullable public java.util.List<java.lang.String> getOptionValues(java.lang.String optionName)
null
signifies
that the option was not present; empty list signifies that no values were associated
with this option.public void addNonOptionArg(java.lang.String value)
public java.util.List<java.lang.String> getNonOptionArgs()