|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dllearner.core.options.ConfigOption<T>
T - The type of the config option, e.g. Integer, String etc.public abstract class ConfigOption<T>
This class represents a configuration option (without a value for the option). Note: Currently, handling the type of a configuration option is not straightforward to implement, because Java Generics information is erased at runtime. This will be fixed in Java 7, in particular JSR 308, which is due at approx. the beginning of 2009.
| Constructor Summary | |
|---|---|
ConfigOption(String name,
String description)
Calls this(name, description, null, false, true). |
|
ConfigOption(String name,
String description,
T defaultValue)
Calls this(name, description, defaultValue, false, true). |
|
ConfigOption(String name,
String description,
T defaultValue,
boolean mandatory,
boolean requiresInit)
Constructs a component configuration option. |
|
| Method Summary | |
|---|---|
abstract boolean |
checkType(Object object)
Checks whether the object has the correct type to be used as a value for this option (this method is necessary, because generic information is erased at runtime in Java). |
String |
getAllowedValuesDescription()
|
T |
getDefaultValue()
|
String |
getDefaultValueInJava()
|
String |
getDescription()
|
String |
getJavaDocString()
|
SortedSet<String> |
getJavaImports()
TODO Method should be removed and a mapping table in ConfigJavaGenerator created instead. |
String |
getName()
|
abstract String |
getValueFormatting(T value)
Get a formatted value to put into configuration file. |
abstract String |
getValueTypeAsJavaString()
|
boolean |
isMandatory()
Specifies whether this option is mandatory for the component. |
abstract boolean |
isValidValue(T value)
Checks whether the value is valid, e.g. passing 1985 as integer value for an option, which requires values between 0 and 1, is not valid. |
boolean |
requiresInit()
Specifies whether setting this option requires that the component or any components depending on this component need to be (re-)initialised. |
void |
setDefaultValue(T defaultValue)
|
void |
setMandatory(boolean mandatory)
|
void |
setRequiresInit(boolean requiresInit)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ConfigOption(String name,
String description)
name - Name of config option.description - Explanation of option.
public ConfigOption(String name,
String description,
T defaultValue)
name - Name of config option.description - Explanation of option.defaultValue - Standard value of option.
public ConfigOption(String name,
String description,
T defaultValue,
boolean mandatory,
boolean requiresInit)
name - Name of config option.description - Explanation of option.defaultValue - Standard value of option.mandatory - Specifies whether assigning a value to the option is required.requiresInit - Says whether init() has to be called again when the option is changed.| Method Detail |
|---|
public String getName()
public String getDescription()
public T getDefaultValue()
public String getDefaultValueInJava()
public boolean isMandatory()
public boolean requiresInit()
public SortedSet<String> getJavaImports()
public abstract boolean checkType(Object object)
object - The object to check.
public abstract boolean isValidValue(T value)
value - A value for the option.
public abstract String getValueTypeAsJavaString()
public String getAllowedValuesDescription()
public void setDefaultValue(T defaultValue)
defaultValue - the defaultValue to setpublic void setMandatory(boolean mandatory)
mandatory - the mandatory to setpublic void setRequiresInit(boolean requiresInit)
requiresInit - the requiresInit to setpublic String toString()
toString in class Objectpublic String getJavaDocString()
public abstract String getValueFormatting(T value)
value - Option value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||