|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.xenqtt.AppContext
public final class AppContext
Contains the application context for a Xenqtt application
| Constructor Summary | |
|---|---|
AppContext()
Create a new instance of this class. |
|
AppContext(List<String> flags,
Map<String,String> arguments)
Create a new instance of this class. |
|
AppContext(List<String> flags,
Map<String,String> arguments,
CountDownLatch latch)
Create a new instance of this class. |
|
| Method Summary | |
|---|---|
void |
applicationDone()
Invoke if your application has finished its work and no longer needs to run. |
boolean |
getArgAsBoolean(String argument)
Get an argument value interpreted as a boolean. |
boolean |
getArgAsBoolean(String argument,
boolean defaultValue)
Get an argument value interpreted as a boolean. |
double |
getArgAsDouble(String argument)
Get an argument value interpreted as a double. |
double |
getArgAsDouble(String argument,
double defaultValue)
Get an argument value interpreted as a double. |
int |
getArgAsInt(String argument)
Get an argument value interpreted as an int. |
int |
getArgAsInt(String argument,
int defaultValue)
Get an argument value interpreted as an int. |
long |
getArgAsLong(String argument)
Get an argument value interpreted as a long. |
long |
getArgAsLong(String argument,
long defaultValue)
Get an argument value interpreted as a long. |
String |
getArgAsString(String argument)
Get an argument value interpreted as a string. |
String |
getArgAsString(String argument,
String defaultValue)
Get an argument value interpreted as a string. |
boolean |
isEmpty()
|
boolean |
isFlagSpecified(String flag)
Determine if a particular flag was specified. |
boolean |
wereAllFlagsInterrogated()
Determine if each of the flags that was specified by the user was interrogated by the application. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AppContext()
public AppContext(List<String> flags,
Map<String,String> arguments)
flags - The flags that were specified for the applicationarguments - The arguments that were specified for the application
public AppContext(List<String> flags,
Map<String,String> arguments,
CountDownLatch latch)
flags - The flags that were specified for the applicationarguments - The arguments that were specified for the applicationlatch - The latch which the main application thread will await on. Trigger this if your application can terminate after
performing certain tasks (e.g. a test)| Method Detail |
|---|
public boolean isFlagSpecified(String flag)
flag - The flag to check for
true if the specified flag was found in the flags that were given by the user, false if it was notpublic boolean wereAllFlagsInterrogated()
true if each user-specified flag was interrogated, false if at least one was notpublic int getArgAsInt(String argument)
int.
argument - The name of the argument
int
IllegalStateException - If the argument is not found
NumberFormatException - If the argument is found but cannot be interpreted as an int
public int getArgAsInt(String argument,
int defaultValue)
int.
argument - The name of the argumentdefaultValue - The default value to use if the argument is not found
int
NumberFormatException - If the argument is found but cannot be interpreted as an intpublic long getArgAsLong(String argument)
long.
argument - The name of the argument
long
IllegalStateException - If the argument is not found
NumberFormatException - If the argument is found but cannot be interpreted as a long
public long getArgAsLong(String argument,
long defaultValue)
long.
argument - The name of the argumentdefaultValue - The default value to use if the argument is not found
long
NumberFormatException - If the argument is found but cannot be interpreted as a longpublic double getArgAsDouble(String argument)
double.
argument - The name of the argument
double
IllegalStateException - If the argument is not found
NumberFormatException - If the argument is found but cannot be interpreted as a double
public double getArgAsDouble(String argument,
double defaultValue)
double.
argument - The name of the argumentdefaultValue - The default value to use if the argument is not found
double
NumberFormatException - If the argument is found but cannot be interpreted as a doublepublic boolean getArgAsBoolean(String argument)
boolean.
argument - The name of the argument
boolean
IllegalStateException - If the argument is not found
NumberFormatException - If the argument is found but cannot be interpreted as a boolean
public boolean getArgAsBoolean(String argument,
boolean defaultValue)
boolean.
argument - The name of the argumentdefaultValue - The default value to use if the argument is not found
boolean
NumberFormatException - If the argument is found but cannot be interpreted as a booleanpublic String getArgAsString(String argument)
string.
argument - The name of the argument
IllegalStateException - If the argument is not found
public String getArgAsString(String argument,
String defaultValue)
string.
argument - The name of the argumentdefaultValue - The default value to use if the argument is not found
public boolean isEmpty()
true if there are no flags or arguments, false if there is at least one flag or argumentpublic void applicationDone()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||