org.exolab.castor.util
Class CommandLineOptions

java.lang.Object
  extended by org.exolab.castor.util.CommandLineOptions

public class CommandLineOptions
extends java.lang.Object

A utility class for generating command line options

Version:
$Revision: 1.2 $ $Date: 2005/03/05 13:41:57 $
Author:
Keith Visco

Field Summary
(package private)  java.io.PrintWriter errorWriter
           
(package private)  java.util.Vector flags
           
(package private)  java.util.Hashtable optionInfo
           
 
Constructor Summary
CommandLineOptions()
           
 
Method Summary
 void addFlag(java.lang.String flag)
          Adds the flag to list of available command line options
 void addFlag(java.lang.String flag, java.lang.String comment)
          Adds the flag to list of available command line options
 void addFlag(java.lang.String flag, java.lang.String usageText, java.lang.String comment)
          Adds the flag to list of available command line options
 void addFlag(java.lang.String flag, java.lang.String usageText, java.lang.String comment, boolean optional)
          Adds the flag to list of available command line options
 java.util.Properties getOptions(java.lang.String[] args)
          parses the arguments into a hashtable with the proper flag as the key
 void printHelp(java.io.PrintWriter pw)
           
 void printUsage(java.io.PrintWriter pw)
           
 void setComment(java.lang.String flag, java.lang.String comment)
          Sets a comment for the flag
 void setOptional(java.lang.String flag, boolean optional)
          Sets whether or not a given flag is optional
 void setUsageInfo(java.lang.String flag, java.lang.String usage)
          Sets the text to print after the flag when printing the usage line
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flags

java.util.Vector flags

optionInfo

java.util.Hashtable optionInfo

errorWriter

java.io.PrintWriter errorWriter
Constructor Detail

CommandLineOptions

public CommandLineOptions()
Method Detail

addFlag

public void addFlag(java.lang.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(java.lang.String flag,
                    java.lang.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(java.lang.String flag,
                    java.lang.String usageText,
                    java.lang.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

addFlag

public void addFlag(java.lang.String flag,
                    java.lang.String usageText,
                    java.lang.String comment,
                    boolean optional)
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
optional, - when true, indicates that this flag is optional

getOptions

public java.util.Properties getOptions(java.lang.String[] args)
parses the arguments into a hashtable with the proper flag as the key


setComment

public void setComment(java.lang.String flag,
                       java.lang.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

setOptional

public void setOptional(java.lang.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(java.lang.String flag,
                         java.lang.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

printUsage

public void printUsage(java.io.PrintWriter pw)

printHelp

public void printHelp(java.io.PrintWriter pw)


Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com