|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object visad.util.CmdlineParser
public class CmdlineParser
Parse command-line arguments passed to the initial main() method
of an application.
To use this, a class would implement CmdlineConsumer,
then add the following code snippet to the constructor
(assuming the constructor is supplied a list of arguments
named 'args'):
CmdlineParser cmdline = new CmdlineParser(this); if (!cmdline.processArgs(args)) {
complain about errors, exit, etc.}
Constructor Summary | |
---|---|
CmdlineParser(Object mainClass)
Create a command-line parser. |
Method Summary | |
---|---|
void |
addConsumer(CmdlineConsumer consumer)
Add a command-line argument/keyword consumer. |
String |
getMainClassName()
Get the name of the main class. |
boolean |
processArgs(String[] args)
Pass all options/keywords on to all CmdlineConsumer s. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CmdlineParser(Object mainClass)
mainClass
- The class in which the main() method lives.Method Detail |
---|
public void addConsumer(CmdlineConsumer consumer)
public String getMainClassName()
public boolean processArgs(String[] args)
CmdlineConsumer
s.
args
- Array of command-line arguments passed to main() method.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |