public class ConfigurationPropertiesImpl extends ConfigurationAbstractImpl<Properties>
Configuration implementation used for Java .properties files| Constructor and Description |
|---|
ConfigurationPropertiesImpl(String sourceId,
File configFile,
EventBus eventBus) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBoolean(String key,
boolean defaultValue)
Retrieves the
boolean configuration value associated with the given key, or the
defaultValue if no value was configured. |
byte |
getByte(String key,
byte defaultValue)
Retrieves the
byte configuration value associated with the given key, or the
defaultValue if no value was configured. |
char |
getChar(String key,
char defaultValue)
Retrieves the
char configuration value associated with the given key, or the
defaultValue if no value was configured. |
double |
getDouble(String key,
double defaultValue)
Retrieves the
double configuration value associated with the given key, or the
defaultValue if no value was configured. |
float |
getFloat(String key,
float defaultValue)
Retrieves the
float configuration value associated with the given key, or the
defaultValue if no value was configured. |
int |
getInt(String key,
int defaultValue)
Retrieves the
int configuration value associated with the given key, or the
defaultValue if no value was configured. |
long |
getLong(String key,
long defaultValue)
Retrieves the
long configuration value associated with the given key, or the
defaultValue if no value was configured. |
short |
getShort(String key,
short defaultValue)
Retrieves the
short configuration value associated with the given key, or the
defaultValue if no value was configured. |
String |
getString(String key,
String defaultValue)
Retrieves the
String configuration value associated with the given key, or the
defaultValue if no value was configured. |
protected String |
getValue(String key)
Fetches the configuration value.
|
<V> V |
getValue(String key,
Function<String,V> valueMappingFunction)
Retrieves the configuration value associated with the given
key by transforming the value using the
valueMappingFunction. |
Properties |
load(File configFile)
Loads the configuration object from the configuration file.
|
getEventBus, getSourceId, getValue, init, onFileEvent, onFileEventMatch, reload, whenConfigFileCreated, whenConfigFileDeleted, whenConfigFileUpdatedpublic ConfigurationPropertiesImpl(String sourceId, File configFile, EventBus eventBus) throws IOException
IOExceptionpublic byte getByte(String key, byte defaultValue)
byte configuration value associated with the given key, or the
defaultValue if no value was configured.key - Non-null configuration keydefaultValue - The default valuepublic short getShort(String key, short defaultValue)
short configuration value associated with the given key, or the
defaultValue if no value was configured.key - Non-null configuration keydefaultValue - The default valuepublic int getInt(String key, int defaultValue)
int configuration value associated with the given key, or the
defaultValue if no value was configured.key - Non-null configuration keydefaultValue - The default valuepublic long getLong(String key, long defaultValue)
long configuration value associated with the given key, or the
defaultValue if no value was configured.key - Non-null configuration keydefaultValue - The default valuepublic float getFloat(String key, float defaultValue)
float configuration value associated with the given key, or the
defaultValue if no value was configured.key - Non-null configuration keydefaultValue - The default valuepublic double getDouble(String key, double defaultValue)
double configuration value associated with the given key, or the
defaultValue if no value was configured.key - Non-null configuration keydefaultValue - The default valuepublic boolean getBoolean(String key, boolean defaultValue)
boolean configuration value associated with the given key, or the
defaultValue if no value was configured.key - Non-null configuration keydefaultValueconfig - The default valuepublic char getChar(String key, char defaultValue)
char configuration value associated with the given key, or the
defaultValue if no value was configured.key - Non-null configuration keydefaultValue - The default valuepublic String getString(String key, String defaultValue)
String configuration value associated with the given key, or the
defaultValue if no value was configured.key - Non-null configuration keydefaultValue - The nullable default valuepublic <V> V getValue(String key, Function<String,V> valueMappingFunction)
key by transforming the value using the
valueMappingFunction.V - key - Non-null configuration keyvalueMappingFunction - Non-null mapping function transforming the configuration value to the desired typeprotected String getValue(String key)
key - Non-null keypublic Properties load(File configFile) throws IOException
ConfigurationconfigFile - Non-null configuration fileIOException - On any I/O error while reading the configuration fileCopyright © 2016–2017. All rights reserved.