org.exolab.adaptx.util

Class CommandLineOptions

public class CommandLineOptions extends Object

A utility class for generating command line options

Version: $Revision: 3633 $ $Date: 2003-03-01 02:38:44 -0500 (Sat, 01 Mar 2003) $

Author: Keith Visco

Constructor Summary
CommandLineOptions()
Method Summary
voidaddFlag(String flag)
Adds the flag to list of available command line options
voidaddFlag(String flag, String comment)
Adds the flag to list of available command line options
voidaddFlag(String flag, String usageText, String comment)
Adds the flag to list of available command line options
PropertiesgetOptions(String[] args)
parses the arguments into a hashtable with the proper flag as the key
voidprintHelp(PrintWriter pw)
voidprintUsage(PrintWriter pw)
voidsetComment(String flag, String comment)
Sets a comment for the flag
voidsetInvokeCommand(String invokeCommand)
Sets the command used to invoke the application
voidsetOptional(String flag, boolean optional)
Sets whether or not a given flag is optional
voidsetUsageInfo(String flag, String usage)
Sets the text to print after the flag when printing the usage line

Constructor Detail

CommandLineOptions

public CommandLineOptions()

Method Detail

addFlag

public void addFlag(String flag)
Adds the flag to list of available command line options

Parameters: 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

Parameters: flag the flag to add as an available command line option comment 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

Parameters: flag the flag to add as an available command line option comment a comment for the flag usageText the text that appears after the flag in the usage string

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

Parameters: flag the flag to set the comment for comment 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

Parameters: 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

Parameters: flag the flag to set optionality for optional 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

Parameters: flag the flag to set the usage info for usage the usage text