public abstract class Option extends Object
All options within the system should have a unique name. No two options shall have a name that is the same when a case insensitive comparison between the names with spaces removed is performed. Only basic alphanumeric characters and spaces are allowed.
The VM is required to provide a one way mapping function that takes the name and creates a VM style name, such as mapping "No Finalizer" to noFinalizer. The VM may not remove any letters when performing this mapping but may remove spaces and change the case of any character.
Modifier and Type | Field and Description |
---|---|
static int |
ADDRESS_OPTION |
static int |
BOOLEAN_OPTION |
private String |
description |
static int |
ENUM_OPTION |
static int |
FLOAT_OPTION |
static int |
INT_OPTION |
private String |
key |
static int |
MICROSECONDS_OPTION |
private String |
name |
private Option |
next |
static int |
PAGES_OPTION |
static int |
RAW |
static int |
READABLE |
protected OptionSet |
set |
static int |
STRING_OPTION |
private int |
type |
static int |
XML |
Modifier | Constructor and Description |
---|---|
protected |
Option(OptionSet set,
int type,
String name,
String description)
Construct a new option.
|
Modifier and Type | Method and Description |
---|---|
protected void |
fail(String message)
A fatal error occurred during the setting of an option.
|
protected void |
failIf(boolean condition,
String message)
Fail if a specified condition is met.
|
String |
getDescription()
Return the option description.
|
String |
getKey()
Return the VM determined key for an option
|
String |
getName()
Return the name for the option.
|
Option |
getNext()
Return the next option in the linked list.
|
int |
getType()
Return the type of the option.
|
(package private) void |
setNext(Option o)
Updates the next pointer in the Option chain.
|
protected void |
validate()
This is a validation method that can be implemented by leaf option
classes to provide additional validation.
|
protected void |
warn(String message)
A non-fatal error occurred during the setting of an option.
|
protected void |
warnIf(boolean condition,
String message)
Warn if a specified condition is met.
|
public static final int BOOLEAN_OPTION
public static final int STRING_OPTION
public static final int ENUM_OPTION
public static final int INT_OPTION
public static final int PAGES_OPTION
public static final int MICROSECONDS_OPTION
public static final int FLOAT_OPTION
public static final int ADDRESS_OPTION
public static final int READABLE
public static final int RAW
public static final int XML
private final int type
private final String description
protected Option(OptionSet set, int type, String name, String description)
set
- The option set this option belongs to.type
- The option type as defined in this class.name
- The unique name of the option.description
- A short description of the option and purpose.void setNext(Option o)
o
- the next option in the chainpublic Option getNext()
public String getDescription()
public int getType()
protected void validate()
protected void fail(String message)
message
- The error message associated with the failure.protected void failIf(boolean condition, String message)
condition
- The condition that indicates failure.message
- The error message associated with the failure.protected void warn(String message)
message
- The message associated with the warning.