public class OptionReader
extends java.lang.Object
OptionType.getDataTypeHint()
ConvertingOptionType
Modifier and Type | Field and Description |
---|---|
static java.text.DateFormat |
DATE_FORMAT |
Modifier and Type | Method and Description |
---|---|
static OptionReader |
create(java.util.Map<java.lang.String,java.lang.String> options,
ModuleDefinition modDef)
Create a new Option reader for the given options map and definitions object
|
static java.lang.String |
fromDataType(OptionType optionType,
java.lang.Object obj)
Converts an option value in its native data type to it's string representation
|
ModuleDefinition |
getModuleDefinition() |
java.util.Map<java.lang.String,java.lang.String> |
getOptions() |
java.lang.Object |
readOptionValueOrDefault(java.lang.String optionName)
Reads an option value and directly returns the native datatype, or the default value if the option is not available
|
static java.lang.Object |
toDataType(OptionType optionType,
java.lang.String stringValue)
Convert a string option to the data type declared by the option type
|
static java.lang.Object |
unconvertOptionValue(OptionDefinition optDef,
java.lang.Object value)
Unconverts an option value to the native data type, based on the given option definition
|
void |
writeOptionValue(java.lang.String optionName,
java.lang.Object optionValue)
Writes a native datatype option value
|
public static java.lang.Object toDataType(OptionType optionType, java.lang.String stringValue) throws OptionConversionException
optionType
- The option type whose OptionType.getDataTypeHint()
will be used as target typestringValue
- The string value of the optionOptionConversionException
public static java.lang.String fromDataType(OptionType optionType, java.lang.Object obj)
obj
- The option value in the data type given by OptionType.getDataTypeHint()
public static OptionReader create(java.util.Map<java.lang.String,java.lang.String> options, ModuleDefinition modDef)
options
- The options mapmodDef
- The module definition whose option definitions are used to read/write optionspublic java.lang.Object readOptionValueOrDefault(java.lang.String optionName) throws OptionConversionException
optionName
- Then name of the optionjava.lang.ClassNotFoundException
OptionConversionException
public static java.lang.Object unconvertOptionValue(OptionDefinition optDef, java.lang.Object value) throws OptionConversionException
optDef
- The option definitionvalue
- The valueOptionConversionException
public void writeOptionValue(java.lang.String optionName, java.lang.Object optionValue) throws OptionConversionException
optionName
- The name of the option to writeoptionValue
- The value to write in its native data type, like given by OptionType.getDataTypeHint()
OptionConversionException
public java.util.Map<java.lang.String,java.lang.String> getOptions()
public ModuleDefinition getModuleDefinition()