|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dellroad.stuff.main.MainClass
public abstract class MainClass
Support superclass for command line classes.
| Field Summary | |
|---|---|
protected Logger |
log
|
| Constructor Summary | |
|---|---|
protected |
MainClass()
|
| Method Summary | |
|---|---|
protected void |
commandLoop(String appName,
String prompt)
Enter command loop. |
protected void |
doMain(String[] args)
Invokes run(java.lang.String[]), catching any exceptions thrown and exiting with a non-zero
value if and only if an exception was caught. |
protected void |
errout(String message)
Emit an error message an exit with exit value 1. |
protected boolean |
handleCommand(String line)
Callback used by commandLoop(java.lang.String, java.lang.String). |
protected String[] |
parsePropertyFlags(String[] args)
Parse command line flags of the form -Dname=value and set the corresponding system properties. |
abstract int |
run(String[] args)
Subclass main implementation. |
protected void |
usageError()
Print the usage message and exit with exit value 1. |
protected abstract void |
usageMessage()
Display the usage message to standard error. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Logger log
| Constructor Detail |
|---|
protected MainClass()
| Method Detail |
|---|
public abstract int run(String[] args)
throws Exception
Exception
protected void commandLoop(String appName,
String prompt)
throws Exception
handleCommand(java.lang.String) for processing.
Exception
protected boolean handleCommand(String line)
throws Exception
commandLoop(java.lang.String, java.lang.String).
The implementation in MainClass just returns false.
Exceptionprotected abstract void usageMessage()
protected void usageError()
protected final void errout(String message)
protected String[] parsePropertyFlags(String[] args)
-Dname=value and set the corresponding system properties.
Parsing stops at the first argument not starting with a dash (or --).
protected void doMain(String[] args)
run(java.lang.String[]), catching any exceptions thrown and exiting with a non-zero
value if and only if an exception was caught.
The concrete class' main() method should invoke this method.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||