|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.util.AbstractMap
java.util.HashMap
com.tensegrity.generic.util.CommandLine
Applications and Applets often have to be provided
with parameters passed to them at startup. Class CommandLine can
be used to parse such arguments via the command line (Application) or parameter
tags (Applet).
When creating an CommandLine instance, be aware of the defined
sequence of parameters in the 2-dimensional array (the second parameter of a
particular constructor).
The arguments are described in the array possibleValues. The expected format of this array is described here:
- Parameter name ([][0]):
Name of the parameter without the leading '-'.
- Optional (Boolean) ([][1]):
Boolean.TRUE, if this parameter is mandatory.
- Default value ([][2]):
The default value, if the no value for this parameter is specified.
- Usage text ([][3]):
A short description telling what this option does
| Constructor Summary | |
CommandLine(java.applet.Applet applet,
CommandLinePossibleValues possibleValues)
Constructor for use with applets. |
|
CommandLine(java.applet.Applet applet,
java.lang.Object[][] possibleValues)
Constructor for use with applets. |
|
CommandLine(java.lang.String[] commandLine,
CommandLinePossibleValues possibleValues)
Constructor for use with applications. |
|
CommandLine(java.lang.String[] commandLine,
java.lang.Object[][] possibleValues)
Constructor for use with applications. |
|
| Method Summary | |
boolean |
booleanValue(java.lang.String parameter)
Returns true, if the given boolean parameter is
given on command line. |
void |
dumpUsage(java.lang.String indent,
java.io.OutputStream stream)
This methods dumps the descriptions for all registered parameter. |
java.lang.String |
toString()
Returns a string representation of this. |
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values |
| Methods inherited from class java.util.AbstractMap |
equals, hashCode |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
equals, hashCode |
| Constructor Detail |
public CommandLine(java.lang.String[] commandLine,
CommandLinePossibleValues possibleValues)
throws java.text.ParseException
commandLine - an array holding the command line as given in a
main function.possibleValues - the possible/default commands/values of the command
line.
java.text.ParseException - if the given strings can't be parsed.
public CommandLine(java.applet.Applet applet,
CommandLinePossibleValues possibleValues)
throws java.text.ParseException
applet - the applet.possibleValues - the possible/default commands/values for the
application.
java.text.ParseException - if a given parameter is mandatory, but invalid
public CommandLine(java.lang.String[] commandLine,
java.lang.Object[][] possibleValues)
throws java.text.ParseException
commandLine - an array holding the command line as given in a
main function.possibleValues - the possible/default commands/values of the command
line.
java.text.ParseException - if the given strings can't be parsed.
public CommandLine(java.applet.Applet applet,
java.lang.Object[][] possibleValues)
throws java.text.ParseException
[0] - Parameter name [1] - Boolean, indicates whether this parameter is mandatory [2] - Default value, indicating the type. Valid types are:java.lang.String java.lang.Boolean java.lang.Integer java.lang.Double java.lang.Float java.lang.Long[3] - usage text
applet - the applet.possibleValues - the possible/default commands/values for the
application.
java.text.ParseException - if a given parameter is mandatory, but invalid| Method Detail |
public boolean booleanValue(java.lang.String parameter)
true, if the given boolean parameter is
given on command line. If not, it returns the default value. If the
parameter is not found false will be returned.
parameter - the parameter name to look up
false if an exception occurs.
public void dumpUsage(java.lang.String indent,
java.io.OutputStream stream)
throws java.io.IOException
indent - a string used to be insert before every line output.stream - the stream to dump to.
java.io.IOException - if an I/O error occurs.public java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||