Top Description Fields Constructors Methods
com.headius.options

public abstract Class Option<T>

extends Object
Class Inheritance
Known Direct Subclasses
com.headius.options.StringOption, com.headius.options.BooleanOption, com.headius.options.EnumerationOption, com.headius.options.IntegerOption
Type Parameters
<T>
the type of value associated with the option
Imports
java.util.ArrayList, .Arrays, .Collection, .Collections, .Comparator, .List

Represents a single option, with a category, name, value type, options, default value, and description. This type should be subclassed for specific types of values.
See Also
StringOption, IntegerOption, BooleanOption, EnumerationOption, Option#string, Option#integer, Option#bool, Option#enumeration

Field Summary

Modifier and TypeField and Description
private final Enum<E extends Enum<E>>
protected final T
private final String
private final String
private String
private volatile boolean
private final String
private static Comparator<Option<T>>
private final T[]
private final String
private final String
private boolean
protected final Class<T>
private volatile T

Constructor Summary

AccessConstructor and Description
public
Option(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Class<T>
the value type of the option
type
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
T[]
a list of supported for the option, or null if the set is not applicable
options
,
T
the default value for the option
defval
,
String
a description for the option
description
)

Create a new option with the given values.

public
Option(String
the property name
longName
,
Class<T>
the value type of the option
type
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
T[]
a list of supported for the option, or null if the set is not applicable
options
,
T
the default value for the option
defval
,
String
a description for the option
description
)

Create a new option with the given values.

Method Summary

Modifier and TypeMethod and Description
public static Option<Boolean>

Returns:

a new Boolean-based Option
bool
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String
a description for the option
description
)

Create a new Boolean option with the given configuration.

public static Option<Boolean>

Returns:

a new Boolean-based Option
bool
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String
a description for the option
description
)

Create a new Boolean option with the given configuration.

public static Option<Boolean>

Returns:

a new Boolean-based Option
bool
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Boolean
the default value for the option
defval
,
String
a description for the option
description
)

Create a new Boolean option with the given configuration.

public static Option<Boolean>

Returns:

a new Boolean-based Option
bool
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Boolean
the default value for the option
defval
,
String
a description for the option
description
)

Create a new Boolean option with the given configuration.

public T

Returns:

the default value for the option, or null if no default is provided.
defaultValue
()

public String

Returns:

the long description of the property, as for documentation and configuration file templates.
description
()

public String

Returns:

the full display name of this option's property
displayName
()

The display name of the option's property, either the short name or the full name.

private static String
public static <
the type of the enum
T extends Enum<T>
>
Option<T>

Returns:

a new Enumeration-based Option
enumeration
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Class<T> enumClass, String
a description for the option
description
)

Create a new Enumeration-based option with the given configuration.

public static <
the type of the enum
T extends Enum<T>
>
Option<T>

Returns:

a new Enumeration-based Option
enumeration
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Class<T> enumClass, String
a description for the option
description
)

Create a new Enumeration-based option with the given configuration.

public static <
the type of the enum
T extends Enum<T>
>
Option<T>

Returns:

a new Enumeration-based Option
enumeration
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
T
the default value for the option
defval
,
String
a description for the option
description
)

Create a new Enumeration-based option with the given configuration.

public static <
the type of the enum
T extends Enum<T>
>
Option<T>

Returns:

a new Enumeration-based Option
enumeration
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
T
the default value for the option
defval
,
String
a description for the option
description
)

Create a new Enumeration-based option with the given configuration.

public synchronized void
force(String
a value to force for the Option's property, as if set in JVM
value
)

Force the property value to the given value for all future loads and reloads.

public static String

Returns:

a formatted string representing the options as a config file or document
formatOptions
(Option<T>...
the options to format
options
)

Format the given options in a way suitable for use as a configuration file or documentation.

public static String

Returns:

a formatted string representing the options as a config file or document
formatOptions
(Collection<Option<T>>
the options to format
options
)

Format the given options in a way suitable for use as a configuration file or documentation.

public static String

Returns:

a formatted string representing the options
formatValues
(Option<T>...
the options to format
options
)

Format the given options to show their loaded values in the current JVM.

public static String

Returns:

a formatted string representing the options
formatValues
(Collection<Option<T>>
the options to format
options
)

Format the given options to show their loaded values in the current JVM.

public static Option<Integer>

Returns:

a new Integer-based Option
integer
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String
a description for the option
description
)

Create a new Integer option with the given configuration.

public static Option<Integer>

Returns:

a new Integer-based Option
integer
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Integer[]
a list of supported for the option, or null if the set is not applicable
options
,
String
a description for the option
description
)

Create a new Integer option with the given configuration.

public static Option<Integer>

Returns:

a new Integer-based Option
integer
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String
a description for the option
description
)

Create a new Integer option with the given configuration.

public static Option<Integer>

Returns:

a new Integer-based Option
integer
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Integer[]
a list of supported for the option, or null if the set is not applicable
options
,
String
a description for the option
description
)

Create a new Integer option with the given configuration.

public static Option<Integer>

Returns:

a new Integer-based Option
integer
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Integer
the default value for the option
defval
,
String
a description for the option
description
)

Create a new Integer option with the given configuration.

public static Option<Integer>

Returns:

a new Integer-based Option
integer
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Integer
the default value for the option
defval
,
String
a description for the option
description
)

Create a new Integer option with the given configuration.

public static Option<Integer>

Returns:

a new Integer-based Option
integer
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Integer[]
a list of supported for the option, or null if the set is not applicable
options
,
Integer
the default value for the option
defval
,
String
a description for the option
description
)

Create a new Integer option with the given configuration.

public static Option<Integer>

Returns:

a new Integer-based Option
integer
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
Integer[]
a list of supported for the option, or null if the set is not applicable
options
,
Integer
the default value for the option
defval
,
String
a description for the option
description
)

Create a new Integer option with the given configuration.

public boolean

Returns:

true if the option's property was specified, false otherwise.
isSpecified
()

public final T

Returns:

the value of the option, loading if it has not been already.
load
()

public synchronized String

Returns:

the option's property's current value, or a value previously forced into this option by force(String)
loadProperty
()

Load the option's property, as if by calling java.lang.System#getProperty

public T[]

Returns:

an array of accepted values, or null if any values are allowed
options
()

The array of accepted values for the option, or null if any values are accepted.

public String

Returns:

the property prefix, or else null
prefix
()

If the property has a prefix, return it.

public String

Returns:

the full property name for the option.
propertyName
()

public final synchronized T

Returns:

the loaded value
reload
()

Force a load of the option's property and return the loaded value.

protected abstract T

Returns:

the updated value after reload
reloadValue
()

Perform the appropriate load and conversion for the option's property.

public String

Returns:

the short name, or else null
shortName
()

If the option has a short name, return it.

public static Option<String>

Returns:

a new String-based option
string
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String
a description for the option
description
)

Create a new String option with the given configuration.

public static Option<String>

Returns:

a new String-based option
string
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String
a description for the option
description
)

Create a new String option with the given configuration.

public static Option<String>

Returns:

a new String-based Option
string
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String
the default value for the option
defval
,
String
a description for the option
description
)

Create a new String option with the given configuration.

public static Option<String>

Returns:

a new String-based Option
string
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String
the default value for the option
defval
,
String
a description for the option
description
)

Create a new String option with the given configuration.

public static Option<String>

Returns:

a new String-based Option
string
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String[]
a list of supported for the option, or null if the set is not applicable
options
,
String
a description for the option
description
)

Create a new String option with the given configuration.

public static Option<String>

Returns:

a new String-based Option
string
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String[]
a list of supported for the option, or null if the set is not applicable
options
,
String
a description for the option
description
)

Create a new String option with the given configuration.

public static Option<String>

Returns:

a new String-based Option
string
(String
the prefix used for loading this option from properties
prefix
,
String
the rest of the property name
shortName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String[]
a list of supported for the option, or null if the set is not applicable
options
,
String
the default value for the option
defval
,
String
a description for the option
description
)

Create a new String option with the given configuration.

public static Option<String>

Returns:

a new String-based Option
string
(String
the property name
longName
,
Enum<E extends Enum<E>>
the category to which this option belongs
category
,
String[]
a list of supported for the option, or null if the set is not applicable
options
,
String
the default value for the option
defval
,
String
a description for the option
description
)

Create a new String option with the given configuration.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public Class<T>

Returns:

the type of option that this is
type
()

The type returned for the option.

public synchronized void
unforce()

Undoes any previous force, and goes back to an unloaded state.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait