|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.osesb.utilities.language.CommandLineOptions
public class CommandLineOptions
Class that parses command line arguments using jakarta-commons-cli. The class provides two constructors. The first will parse command line arguments against pre-registered command line options that are used throughout the framework (see the static initialization). The second, does the same, but allows the caller to pass additional Options to parse against.
| Field Summary | |
|---|---|
protected org.apache.commons.cli.Options |
allOptions
all options - registered and added. |
protected org.apache.commons.cli.CommandLine |
commandLine
CommandLine object. |
protected java.lang.String[] |
commandlineArgs
the arguments we were created with. |
protected static org.apache.commons.cli.Options |
registeredOptions
Registered options - the options we know about. |
| Constructor Summary | |
|---|---|
CommandLineOptions(java.lang.String[] args)
Creates a new instance of CommandLineOptions using the pre-registered options, above. |
|
CommandLineOptions(java.lang.String[] args,
org.apache.commons.cli.Options additionalOptions)
Creates a new instance of CommandLineOptions using the pre-registered options, above, and additional Options passed by the caller. |
|
| Method Summary | |
|---|---|
void |
addOption(org.apache.commons.cli.Option option)
Add an option to registeredOptions. |
org.apache.commons.cli.CommandLine |
getCommandLine()
Returns an org.apache.commons.cli.CommandLine Object that results from parsing the command line against the registered Options. |
java.lang.String |
getOptionValue(java.lang.String option)
Returns the value of a command line argument. |
java.lang.String |
getOptionValue(java.lang.String option,
java.lang.String defaultValue)
Returns the value of a command line argument. |
boolean |
hasOption(java.lang.String option)
Returns true if the command line contains the option. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.apache.commons.cli.CommandLine commandLine
protected static org.apache.commons.cli.Options registeredOptions
protected org.apache.commons.cli.Options allOptions
protected java.lang.String[] commandlineArgs
| Constructor Detail |
|---|
public CommandLineOptions(java.lang.String[] args)
throws java.lang.Exception
args - The commandline arguments to parse.
java.lang.Exception - if there are problems parsing the command line arguments.
The caller will normally display a usage summary on an exception.
public CommandLineOptions(java.lang.String[] args,
org.apache.commons.cli.Options additionalOptions)
throws java.lang.Exception
args - The commandline arguments to parse.additionalOptions - Additional org.apache.commons.cli.Options to use when
parsing the command line.
java.lang.Exception - if there are problems parsing the command line arguments.
The caller will normally display a usage summary on an exception.| Method Detail |
|---|
public void addOption(org.apache.commons.cli.Option option)
throws java.lang.Exception
option - The Option to add.
java.lang.Exception - if there are problems parsing the command line arguments
against the options.public java.lang.String getOptionValue(java.lang.String option)
option - The command line argument to get the value of.
public java.lang.String getOptionValue(java.lang.String option,
java.lang.String defaultValue)
option - The command line argument to get the value of.defaultValue - The value to be returned if the command line
argument was not found.
public boolean hasOption(java.lang.String option)
option - The command line argument to check.
public org.apache.commons.cli.CommandLine getCommandLine()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||