|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kiwi.util.CommandLineParser
A class that does approximately what getopt()
does in C. For
use in Java applications. Includes GNU longopt support.
Field Summary | |
protected Hashtable |
optionlist
The internal storage of options. |
String[] |
params
The list of parameters that weren't arguments to options. |
Constructor Summary | |
CommandLineParser(String[] argv,
String validFlags,
String validOptions)
Construct a new CommandLineParser without longopt
support. |
|
CommandLineParser(String[] argv,
String validFlags,
String validOptions,
String[] validLongFlags,
String[] validLongOptions)
Construct a new CommandLineParser . |
|
CommandLineParser(String[] argv,
String validFlags,
String validOptions,
String requiredOptions,
String[] validLongFlags,
String[] validLongOptions,
String[] requiredLongOptions)
Construct a new CommandLineParser with required options that
must have parameters if specified. |
Method Summary | |
String |
getOption(Character option)
Get the value of the named option. |
String |
getOption(String option)
Get the value of the named option. |
boolean |
hasOption(Character option)
Check if the command line contains the named option. |
boolean |
hasOption(String option)
Check if the command line contains the named option. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public String[] params
protected Hashtable optionlist
Constructor Detail |
public CommandLineParser(String[] argv, String validFlags, String validOptions, String[] validLongFlags, String[] validLongOptions) throws InvalidCommandLineArgumentException
CommandLineParser
.argv
- Array of strings (usually argv).validFlags
- A string of valid options that don't take arguments.validOptions
- A string of valid options that take (optional)
arguments.validLongFlags
- Array of strings that are valid options that
don't take arguments.validLongOptions
- Array of strings that are valid options that
take (optional) arguments.public CommandLineParser(String[] argv, String validFlags, String validOptions) throws InvalidCommandLineArgumentException
CommandLineParser
without longopt
support.argv
- Array of strings (usually argv).validFlags
- A string of valid options that don't take arguments.validOptions
- A string of valid options that take (optional)
arguments.public CommandLineParser(String[] argv, String validFlags, String validOptions, String requiredOptions, String[] validLongFlags, String[] validLongOptions, String[] requiredLongOptions) throws InvalidCommandLineArgumentException, MissingCommandLineArgumentException
CommandLineParser
with required options that
must have parameters if specified.argv
- Array of strings (usually argv).validFlags
- A string of valid options that don't take argumentsvalidOptions
- A string of valid options that take (optional)
arguments.requiredOptions
- A string of valid options that must be provided
with arguments.validlongflags
- Array of strings that are valid options that don't
take arguments.validLongOptions
- array of strings that are valid options that take
(optional) arguments.requiredLongOptions
- Array of strings that are valid options that
must be provided with arguments.Method Detail |
public boolean hasOption(Character option)
option
- The (short) option.public boolean hasOption(String option)
option
- The (long) option.public String getOption(Character option)
option
- The (short) option.public String getOption(String option)
option
- The (long) option.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |