public abstract class AbstractParam extends Object implements Cloneable
Constructor and Description |
---|
AbstractParam() |
Modifier and Type | Method and Description |
---|---|
AbstractParam |
clone() |
protected boolean |
getBoolean(String key,
boolean defaultValue)
Gets the
boolean with the given configuration key. |
org.apache.commons.configuration.FileConfiguration |
getConfig()
Gets the configuration file, previously loaded.
|
protected int |
getInt(String key,
int defaultValue)
Gets the
int with the given configuration key. |
protected Integer |
getInteger(String key,
Integer defaultValue)
Gets the
Integer with the given configuration key. |
protected String |
getString(String key,
String defaultValue)
Gets the
String with the given configuration key. |
void |
load(org.apache.commons.configuration.FileConfiguration config)
Loads the configurations from the given configuration file.
|
void |
load(String filePath)
Loads the configurations from the file located at the given path.
|
void |
load(String filePath,
ControlOverrides overrides)
Loads the configurations from the file located at the given path and using the given
overrides
|
protected static void |
logConversionException(String key,
org.apache.commons.configuration.ConversionException e)
Logs the given
ConversionException , that occurred while reading the configuration
with the given key. |
protected abstract void |
parse()
Parses the configurations.
|
void |
reset()
Will be called to reset the options to factory defaults.
|
public void load(org.apache.commons.configuration.FileConfiguration config)
config
- the configuration filepublic void load(String filePath)
filePath
- the path to the configuration file, might be relative.public void load(String filePath, ControlOverrides overrides)
filePath
- the path to the configuration file, might be relative.overrides
- the configuration overrides, might be null
.public org.apache.commons.configuration.FileConfiguration getConfig()
public AbstractParam clone()
protected abstract void parse()
Called each time the configurations are loaded.
getConfig()
public void reset()
protected String getString(String key, String defaultValue)
String
with the given configuration key.
The default value is returned if the key doesn't exist or it's not a String
.
key
- the configuration key.defaultValue
- the default value, if the key doesn't exist or it's not a String
.protected static void logConversionException(String key, org.apache.commons.configuration.ConversionException e)
ConversionException
, that occurred while reading the configuration
with the given key.key
- the configuration key.e
- the ConversionException
.protected boolean getBoolean(String key, boolean defaultValue)
boolean
with the given configuration key.
The default value is returned if the key doesn't exist or it's not a boolean
.
key
- the configuration key.defaultValue
- the default value, if the key doesn't exist or it's not a boolean
.protected int getInt(String key, int defaultValue)
int
with the given configuration key.
The default value is returned if the key doesn't exist or it's not a int
.
key
- the configuration key.defaultValue
- the default value, if the key doesn't exist or it's not an int
.protected Integer getInteger(String key, Integer defaultValue)
Integer
with the given configuration key.
The default value is returned if the key doesn't exist or it's not a Integer
.
key
- the configuration key.defaultValue
- the default value, if the key doesn't exist or it's not an Integer
.