Package com.gengoai.application
Class CommandLineApplication
- java.lang.Object
-
- com.gengoai.application.Application
-
- com.gengoai.application.CommandLineApplication
-
- All Implemented Interfaces:
Serializable
,Runnable
public abstract class CommandLineApplication extends Application
Abstract base class for a command line application. Child classes should implement the
programLogic
method and create a main method calling theApplication.run(String[])
method. An example application is listed below.public class MyApplication extends CommandLineApplication { public static void main(String[] args) { new MyApplication().run(args); } public void programLogic() throws Exception { //Logic goes here. } }
- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.gengoai.application.Application
Application.Description
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CommandLineApplication()
Instantiates a new Application.protected
CommandLineApplication(String applicationName)
Instantiates a new Application.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
programLogic()
Child classes override this method adding their program logic.void
run()
void
setup()
Runs specialized code to setup the application before theRunnable.run()
command is called.-
Methods inherited from class com.gengoai.application.Application
getAllArguments, getDependentPackages, getName, getPositionalArgs, run
-
-
-
-
Constructor Detail
-
CommandLineApplication
protected CommandLineApplication()
Instantiates a new Application.
-
CommandLineApplication
protected CommandLineApplication(String applicationName)
Instantiates a new Application.- Parameters:
applicationName
- the application name
-
-
Method Detail
-
programLogic
protected abstract void programLogic() throws Exception
Child classes override this method adding their program logic.- Throws:
Exception
- Something abnormal happened.
-
run
public final void run()
-
setup
public void setup() throws Exception
Description copied from class:Application
Runs specialized code to setup the application before the
Runnable.run()
command is called.- Specified by:
setup
in classApplication
- Throws:
Exception
- Something went wrong during setup.
-
-