|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hyphenType.wrapper.StandAloneAppWrapper
public class StandAloneAppWrapper
A wrapper that can be called instead of a standard main class. When called as a main class, this class will try to find which class is the actual main class of the application. After this actual main class was found, this class will parse the arguments to a options interface and give an instance of the options interface to the actual main class.
Field Summary | |
---|---|
static String |
ARGUMENT
The especial argument that explicitly sets which is the main class. |
static String |
KEY
Manifest files can have a key value pair with this key to explicitly set which is the actual main class. |
Constructor Summary | |
---|---|
StandAloneAppWrapper()
|
Method Summary | ||
---|---|---|
protected Options |
buildOptionsObject(Class<?> mainClass,
String[] arguments)
Ready to be overridden in a subclass. |
|
void |
invokeMain(Class<?> mainClass,
String[] arguments)
Invokes the main method of the given class. |
|
void |
invokeMain(Class<?> mainClass,
String[] arguments,
boolean trapThrowable)
Invokes the main method of the given class. |
|
static void |
main(Class<?> mainClass,
String... arguments)
A safer main method. |
|
static void |
main(String... arguments)
Standard main method. |
|
protected static boolean |
mainClassInvalid(String mainClassName)
|
|
static
|
options()
Gives system-wide access to the options object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String KEY
public static final String ARGUMENT
Constructor Detail |
---|
public StandAloneAppWrapper()
Method Detail |
---|
public static void main(String... arguments) throws Throwable
arguments
- Arguments from the command line.
Throwable
- Anything that can go wrong.protected static boolean mainClassInvalid(String mainClassName)
public static void main(Class<?> mainClass, String... arguments) throws Throwable
mainClass
- The main class to execute.arguments
- The arguments, from command line.
Throwable
- Anything that can go wrong.public final void invokeMain(Class<?> mainClass, String[] arguments) throws Throwable
mainClass
- The main class to be executed.arguments
- The arguments received from the command line.trapThrowable
- If true, this method will prevent throwables from going
uncaught to the JVM, which causes the throwable to be
printed in user's console.
Throwable
- Anything that can go wrong.public final void invokeMain(Class<?> mainClass, String[] arguments, boolean trapThrowable) throws Throwable
mainClass
- The main class to be executed.arguments
- The arguments received from the command line.trapThrowable
- If true, this method will prevent throwables from going uncaught to the JVM, which causes the throwable to be printed in user's console.
Throwable
- Anything that can go wrong.protected Options buildOptionsObject(Class<?> mainClass, String[] arguments) throws InvalidOptionsInterfaceException, OptionValuesException, OptionsExtractorException
mainClass
- The options interface type.arguments
- The arguments, as received from the command line.
InvalidOptionsInterfaceException
- If the options interface is invalid. There are many reasons
why an options interface may be invalid. For a detailed
description on the conditions for an options interface to be
invalid, please refer to
InvalidOptionsInterfaceException
OptionValuesException
- If there is anything wrong with the arguments passed. For an
in depth description, please refer to
OptionsExtractor.options(UserInput, String...)
.
OptionsExtractorException
public static <E extends Options<?>> E options()
StandAloneAppWrapper
to start your application, this method will
return null. Avoid using this method if you use the StandAloneAppWrapper
for any purpose else than running the main class.
E
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |