|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mcdermottroe.exemplar.ui.Options
public final class Options
A class to allow for the global tracking of options selected via any of the UI modules.
| Field Summary | |
|---|---|
private static boolean |
debug
Special case for the debug option to prevent infinite looping in assertions. |
private static Map<String,Option<?>> |
options
The map containing all of the options. |
private static boolean |
uiFinished
Whether or not the UI has finished setting the options. |
| Constructor Summary | |
|---|---|
private |
Options()
Private constructor to make sure that nobody can instantiate this class. |
| Method Summary | |
|---|---|
static boolean |
allMandatoryOptionsSet()
Check that all of the mandatory options have been set. |
static String |
describeDefault(String optionName)
Format the current value of the Option as a human readable
String. |
private static Option<?> |
get(String optionName)
Get the value associated with a particular option. |
static Boolean |
getBoolean(String optionName)
Convenience routine for getting the value of an Option which is
known to be a Boolean. |
static String |
getDescription(String optionName)
Get the description registered for the given option. |
static Map<String,String> |
getEnumDescriptions(String optionName)
Get the descriptions of the valid values for a given Enum. |
static Integer |
getInteger(String optionName)
Convenience routine for getting the value of an Option which is
known to be a Integer. |
static Set<String> |
getOptionNames()
Get the names of all the options. |
static String |
getString(String optionName)
Convenience routine for getting the value of an Option which is
known to be a String. |
private static void |
init()
Initialisation routine to get the options Map synced up with the .properties file which defines the legal options and their values. |
static boolean |
isArgument(String optionName)
Check if the named option is an Argument, in other words, it
takes one value only. |
static boolean |
isDebugSet()
Find out if debugging functionality is activated. |
static boolean |
isEnum(String optionName)
Check if the named option is an Enum, in other words, it takes
one or more values all of which must be from a specific set of values. |
static boolean |
isInitialised()
Check if the options store has been initialised. |
static boolean |
isLegal(String optionName)
Determine whether or not a given option name is legal. |
static boolean |
isMandatory(String optionName)
Convenience routine for finding out if an Option is mandatory or
not. |
static boolean |
isMultiValue(String optionName)
Convenience routine for finding out if an Option is a
multi-value type or not. |
static boolean |
isSet(String enumName,
String enumValue)
Convenience routine for testing whether or not a particular value in an Enum is set. |
static boolean |
isSwitch(String optionName)
Check if the named option is a Switch, in other words, it takes
no value. |
static void |
reset()
Reset the options back to the default. |
static void |
set(String optionName,
String optionValue)
Set the value of a particular option in the stash. |
static void |
setUIFinished()
Allow a UI to notify other parts of the program that it has finished setting all the options that it's going to set. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static Map<String,Option<?>> options
private static boolean uiFinished
private static boolean debug
| Constructor Detail |
|---|
private Options()
| Method Detail |
|---|
private static void init()
public static void reset()
public static void setUIFinished()
public static boolean isDebugSet()
public static boolean isInitialised()
public static Set<String> getOptionNames()
private static Option<?> get(String optionName)
optionName - The name of the option to return the value for.
public static void set(String optionName,
String optionValue)
optionName - The name of the option to set.optionValue - The value of the option to set.public static boolean isLegal(String optionName)
optionName - The name of the option to check
public static boolean isMandatory(String optionName)
Option is mandatory or
not.
optionName - The name of the option to check.
Option is mandatory, false
otherwise.public static boolean isMultiValue(String optionName)
Option is a
multi-value type or not.
optionName - The name of the Option to check.
Option is a multi-value, false
otherwise.public static String getDescription(String optionName)
optionName - The name of the option the description of which to
fetch.
public static Map<String,String> getEnumDescriptions(String optionName)
Enum.
optionName - The name of the Enum.
Map where the keys are the names of the
allowed Enum values and the values are the
descriptions of those values. Returns null if the
option requested is not an Enum.public static String describeDefault(String optionName)
Option as a human readable
String.
optionName - The name of the Option the value of which to
describe.
public static String getString(String optionName)
Option which is
known to be a String.
optionName - The name of the Option to fetch.
String if the option holds a String, returns null otherwise.public static Boolean getBoolean(String optionName)
Option which is
known to be a Boolean.
optionName - The name of the Option to fetch.
Boolean if the option holds a Boolean, null otherwise.public static Integer getInteger(String optionName)
Option which is
known to be a Integer.
optionName - The name of the Option to fetch.
Integer if the option holds a Integer, null otherwise.
public static boolean isSet(String enumName,
String enumValue)
Enum is set.
enumName - The name of the EnumenumValue - The value to query
Enum, false if it is not, throws an
exception for all other conditions.public static boolean allMandatoryOptionsSet()
public static boolean isArgument(String optionName)
Argument, in other words, it
takes one value only.
optionName - The name of the option to check.
Argument, false
otherwise.public static boolean isEnum(String optionName)
Enum, in other words, it takes
one or more values all of which must be from a specific set of values.
optionName - The name of the option to check.
Enum, false
otherwise.public static boolean isSwitch(String optionName)
Switch, in other words, it takes
no value. The presence of the option indicates "true" and the absence
"false".
optionName - The name of the option to check.
Switch, false
otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||