|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.saffron.util.MainApp
Abstract base class for a Java application invoked from the command-line.
Example usage:
public class MyClass extends MainApp { public static void main(String[] args) { new MyClass(args).run(); } public void mainImpl() { System.out.println("Hello, world!"); } }
Field Summary | |
protected String[] |
args_
|
private int |
exitCode_
|
private OptionsList |
options_
|
Constructor Summary | |
protected |
MainApp(String[] args)
|
Method Summary | |
void |
handle(Throwable throwable)
Handles an error. |
protected void |
initializeOptions()
Initializes the application. |
abstract void |
mainImpl()
Does the work of the application. |
void |
parseOptions(OptionsList.OptionHandler values)
|
void |
run()
Does the work of the application, handles any errors, then calls System.exit(int) to terminate the application. |
void |
setExitCode(int exitCode)
Sets the code which this program will return to the operating system. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final String[] args_
private OptionsList options_
private int exitCode_
Constructor Detail |
protected MainApp(String[] args)
Method Detail |
public abstract void mainImpl() throws Exception
run()
will
clean up after them.
Exception
public final void run()
System.exit(int)
to terminate the application.
public void setExitCode(int exitCode)
exitCode
- Exit codeSystem.exit(int)
public void handle(Throwable throwable)
throwable
- Error to handle.public void parseOptions(OptionsList.OptionHandler values)
protected void initializeOptions()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |