|
Qizx/Open v0.4p2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.xfra.qizxopen.util.CmdLine
Command line option analyzer.
Options are defined. When an option is recognized by the parse method, either a field of a target application object can be set, or a method of this object can be invoked.
Nested Class Summary | |
static class |
CmdLine.Error
|
Constructor Summary | |
CmdLine(java.lang.String appName)
Creation with an application name. |
Method Summary | |
void |
define(java.lang.String keyDef,
java.lang.String argLabel,
java.lang.String actionDef,
java.lang.String help)
Defines an option. |
void |
parse(java.lang.String[] args,
java.lang.Object appli)
Parses the command line. |
void |
printHelp(java.io.PrintStream out)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CmdLine(java.lang.String appName)
Options must then be defined by define().
appName
- name of the applicationMethod Detail |
public void define(java.lang.String keyDef, java.lang.String argLabel, java.lang.String actionDef, java.lang.String help)
keyDef
- appearance of the option switch. A null key means stray argument.
The last character defines how an argument of this switch is processed (the argument value can be assigned to a field or passed to a method, according to parameter actionDef):
argLabel
- A description of the argument.actionDef
- name of a Java field or a method of the application object. The
first character defines the action: '!' calls a method, '=' sets a field, '?'
prints the help.help
- option help description.public void parse(java.lang.String[] args, java.lang.Object appli) throws java.lang.Exception
Option switches can either set the value of a member of object 'appli', or call a method of this object.
java.lang.Exception
public void printHelp(java.io.PrintStream out)
|
Copyright Xavier FRANC 2003-2004 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |