| 
© 2001 BEA Systems, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.beasys.commerce.util.ArgsParser
Parses the arguments passed to public static void main(String args[]) Subclasses specify their application's grammar in the constructor.
| Inner Class Summary | |
static class | 
ArgsParser.HelpSpecifiedException
The user specified -? or -h  | 
static class | 
ArgsParser.UsageException
The user entered unparseable data  | 
| Constructor Summary | |
protected  | 
ArgsParser(java.lang.String commandName,
           java.lang.String commandDefinition,
           java.lang.String[] args)
 | 
| Method Summary | |
protected  void | 
addParameter(java.lang.String name,
             boolean required,
             java.lang.String defaultValue,
             java.lang.String definition)
Specify a command parameter.  | 
protected  void | 
addParameter(java.lang.String name,
             boolean required,
             java.lang.String defaultValue,
             java.lang.String[] validValues,
             java.lang.String definition,
             java.lang.String[] validValuesDefinition)
Specify a command parameter, restricted to specific values.  | 
protected  void | 
addQualifier(java.lang.String name,
             boolean required,
             java.lang.String defaultValue,
             java.lang.String definition)
Specify a command qualifier.  | 
protected  void | 
addQualifier(java.lang.String name,
             boolean required,
             java.lang.String defaultValue,
             java.lang.String[] validValues,
             java.lang.String definition,
             java.lang.String[] validValuesDefinition)
Specify a command qualifier, restricted to specific values.  | 
 boolean | 
getParameterSpecified(java.lang.String name)
 | 
 java.lang.String | 
getParameterValue(java.lang.String name)
Retreive the value of a parameter.  | 
 boolean | 
getQualifierSpecified(java.lang.String name)
 | 
 java.lang.String | 
getQualifierValue(java.lang.String name)
Retreive the value of a qualifier.  | 
 void | 
parse()
Parse the command line  | 
 void | 
printUsage(java.io.PrintStream printStream)
Print a usage message  | 
| Methods inherited from class java.lang.Object | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
protected ArgsParser(java.lang.String commandName,
                     java.lang.String commandDefinition,
                     java.lang.String[] args)
commandName - the name of the command (used in printUsage())commandDefinition - the definition of the command (used in printUsage())args - command line arguments (parameter of public static void main(String args[])| Method Detail | 
public void printUsage(java.io.PrintStream printStream)
printStream - the target stream for the usage message
public void parse()
           throws ArgsParser.UsageException,
                  ArgsParser.HelpSpecifiedException,
                  java.lang.Error
ArgsParser.UsageException - the user entered unparseable data.  You should print this exceptions's getMessage(), followed by printUsage()ArgsParser.HelpSpecifiedException - the user specified "-?" or "-h".  You should call printUsage() for this exception.java.lang.Error - a development bug.  call getMessage() for the reason
protected void addQualifier(java.lang.String name,
                            boolean required,
                            java.lang.String defaultValue,
                            java.lang.String[] validValues,
                            java.lang.String definition,
                            java.lang.String[] validValuesDefinition)
name - the name of the qualifier.  The name must begin with "-"required - set to true if the qualifier is requireddefaultValue - default value of the qualifier.  set to null if no default valuevalidValues - array of restrictions for values of this qualifierdefinition - the definition of this qualifier.  Used in printUsage()validValuesDefinition - definition of each valid value.  Used in printUsage();
protected void addQualifier(java.lang.String name,
                            boolean required,
                            java.lang.String defaultValue,
                            java.lang.String definition)
name - the name of the qualifier.  The name must begin with "-"required - set to true if the qualifier is requireddefaultValue - default value of the qualifier.  set to null if no default valuedefinition - the definition of this qualifier.  Used in printUsage()
protected void addParameter(java.lang.String name,
                            boolean required,
                            java.lang.String defaultValue,
                            java.lang.String[] validValues,
                            java.lang.String definition,
                            java.lang.String[] validValuesDefinition)
name - the name of the parameter.required - set to true if the parameter is requireddefaultValue - default value of the parameter.  set to null if no default valuevalidValues - array of restrictions for values of this parameterdefinition - the definition of this parameter.  Used in printUsage()validValuesDefinition - definition of each valid value.  Used in printUsage();
protected void addParameter(java.lang.String name,
                            boolean required,
                            java.lang.String defaultValue,
                            java.lang.String definition)
name - the name of the parameter.required - set to true if the parameter is requireddefaultValue - default value of the parameter.  set to null if no default valuedefinition - the definition of this parameter.  Used in printUsage()
public java.lang.String getQualifierValue(java.lang.String name)
                                   throws java.lang.Error
name - the name of a qualifierjava.lang.Error - a development buggetQualifierSpecified(java.lang.String)
public boolean getQualifierSpecified(java.lang.String name)
                              throws java.lang.Error
the - name of a qualifierjava.lang.Error - a development bug.  call getMessage() for the reason
public java.lang.String getParameterValue(java.lang.String name)
                                   throws java.lang.Error
name - the name of a parameterjava.lang.Error - a development bug.  call getMessage() for the reasongetParameterSpecified(java.lang.String)
public boolean getParameterSpecified(java.lang.String name)
                              throws java.lang.Error
the - name of a parameterjava.lang.Error - a development bug.  call getMessage() for the reason
  | 
© 2001 BEA Systems, Inc. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||