public class CommandLineParser extends Object
Constructor and Description |
---|
CommandLineParser(String[] aCommandLine)
The constructor requires the caller to provide it with a command line
arguments String[] that will be the basis of the parsing.
|
CommandLineParser(String[] aCommandLine,
String[] aOptionArgs)
|
Modifier and Type | Method and Description |
---|---|
String[] |
getFlags()
This method will report on all flags that have been found, or return an
empty String[] if none were present.
|
String |
getOptionParameter(String aOption)
This method will report the option parameter for an option that can take
a parameter itself.
|
String[] |
getOptions()
This method will report on all options that have been found, or return an
empty String[] if none were present.
|
String[] |
getParameters()
This method will report on all parameters that have been found, or return
an empty String[] if none were present.
|
boolean |
hasArguments()
This method returns 'true' if any arguments are present, 'false'
otherwise.
|
boolean |
hasFlag(String aFlag)
This method test whether the specified flag was set on the command line.
|
public CommandLineParser(String[] aCommandLine)
aCommandLine
- String[] with the command-line arguments.public CommandLineParser(String[] aCommandLine, String[] aOptionArgs)
aCommandLine
- String[] with the command-line arguments.aOptionArgs
- String[] with the options that take parameters
themselves.public boolean hasArguments()
public String[] getFlags()
public String[] getOptions()
public String[] getParameters()
public String getOptionParameter(String aOption)
aOption
- String with the option for which the parameter is to be
retrieved.public boolean hasFlag(String aFlag)
aFlag
- String with the flag to check. Comparison is case-sensitive!Copyright © 2016. All rights reserved.