org.exolab.adaptx.util
Class CommandLineOptions
java.lang.Object
org.exolab.adaptx.util.CommandLineOptions
public class CommandLineOptions
extends java.lang.Object
A utility class for generating command line options
Version:
- Keith Visco
void | addFlag(String flag) - Adds the flag to list of available command line options
|
void | addFlag(String flag, String comment) - Adds the flag to list of available command line options
|
void | addFlag(String flag, String usageText, String comment) - Adds the flag to list of available command line options
|
Properties | getOptions(String[] args) - parses the arguments into a hashtable with the proper flag
as the key
|
void | printHelp(PrintWriter pw)
|
void | printUsage(PrintWriter pw)
|
void | setComment(String flag, String comment) - Sets a comment for the flag
|
void | setInvokeCommand(String invokeCommand) - Sets the command used to invoke the application
|
void | setOptional(String flag, boolean optional) - Sets whether or not a given flag is optional
|
void | setUsageInfo(String flag, String usage) - Sets the text to print after the flag when printing the usage line
|
CommandLineOptions
public CommandLineOptions()
addFlag
public void addFlag(String flag)
Adds the flag to list of available command line options
flag
- the flag to add as an available command line option
addFlag
public void addFlag(String flag,
String comment)
Adds the flag to list of available command line options
flag
- the flag to add as an available command line optioncomment
- a comment for the flag
addFlag
public void addFlag(String flag,
String usageText,
String comment)
Adds the flag to list of available command line options
flag
- the flag to add as an available command line optionusageText
- the text that appears after the flag in the
usage stringcomment
- a comment for the flag
getOptions
public Properties getOptions(String[] args)
parses the arguments into a hashtable with the proper flag
as the key
printHelp
public void printHelp(PrintWriter pw)
printUsage
public void printUsage(PrintWriter pw)
setComment
public void setComment(String flag,
String comment)
Sets a comment for the flag
flag
- the flag to set the comment forcomment
- the comment to use when printing help for the given flag
setInvokeCommand
public void setInvokeCommand(String invokeCommand)
Sets the command used to invoke the application
invokeCommand
- the command used to invoke the application
setOptional
public void setOptional(String flag,
boolean optional)
Sets whether or not a given flag is optional
flag
- the flag to set optionality foroptional
- the boolean indicating the optionality for the given flag
setUsageInfo
public void setUsageInfo(String flag,
String usage)
Sets the text to print after the flag when printing the usage line
flag
- the flag to set the usage info forusage
- the usage text