public class CommandLineParser
extends java.lang.Object
Constructor and Description |
---|
CommandLineParser(java.lang.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(java.lang.String[] aCommandLine,
java.lang.String[] aOptionArgs)
|
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getFlags()
This method will report on all flags that have been found,
or return an empty String[] if none were present.
|
java.lang.String |
getOptionParameter(java.lang.String aOption)
This method will report the option parameter for an option
that can take a parameter itself.
|
java.lang.String[] |
getOptions()
This method will report on all options that have been found,
or return an empty String[] if none were present.
|
java.lang.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(java.lang.String aFlag)
This method test whether the specified flag was set on the commandline.
|
public CommandLineParser(java.lang.String[] aCommandLine)
aCommandLine
- String[] with the command-line arguments.public CommandLineParser(java.lang.String[] aCommandLine, java.lang.String[] aOptionArgs)
aCommandLine
- String[] with the command-line arguments.aOptionArgs
- String[] with the options that take
parameters themselves.public boolean hasArguments()
public java.lang.String[] getFlags()
public java.lang.String[] getOptions()
public java.lang.String[] getParameters()
public java.lang.String getOptionParameter(java.lang.String aOption)
aOption
- String with the option for which the parameter is
to be retrieved.public boolean hasFlag(java.lang.String aFlag)
aFlag
- String with the flag to check. Comparison is case-sensitive!Copyright © 2013. All Rights Reserved.