Modifier and Type | Method and Description |
---|---|
static boolean |
getBoolean(String key,
boolean defaultValue)
Returns the value associated with the given key as a boolean.
|
static Configuration |
getConfiguration()
Gets a
Configuration object with the values of this GlobalConfiguration |
static float |
getFloat(String key,
float defaultValue)
Returns the value associated with the given key as a float.
|
static int |
getInteger(String key,
int defaultValue)
Returns the value associated with the given key as an integer.
|
static long |
getLong(String key,
long defaultValue)
Returns the value associated with the given key as a long integer.
|
static String |
getString(String key,
String defaultValue)
Returns the value associated with the given key as a string.
|
static void |
includeConfiguration(Configuration conf)
Merges the given
Configuration object into the global
configuration. |
static void |
loadConfiguration(String configDir)
Loads the configuration files from the specified directory.
|
public static String getString(String key, String defaultValue)
key
- the key pointing to the associated valuedefaultValue
- the default value which is returned in case there is no value associated with the given keypublic static long getLong(String key, long defaultValue)
key
- the key pointing to the associated valuedefaultValue
- the default value which is returned in case there is no value associated with the given keypublic static int getInteger(String key, int defaultValue)
key
- the key pointing to the associated valuedefaultValue
- the default value which is returned in case there is no value associated with the given keypublic static float getFloat(String key, float defaultValue)
key
- the key pointing to the associated valuedefaultValue
- the default value which is returned in case there is no value associated with the given keypublic static boolean getBoolean(String key, boolean defaultValue)
key
- the key pointing to the associated valuedefaultValue
- the default value which is returned in case there is no value associated with the given keypublic static void loadConfiguration(String configDir)
XML and YAML are supported as configuration files. If both XML and YAML files exist in the configuration directory, keys from YAML will overwrite keys from XML.
configDir
- the directory which contains the configuration filespublic static Configuration getConfiguration()
Configuration
object with the values of this GlobalConfigurationConfiguration
object including the key/value pairspublic static void includeConfiguration(Configuration conf)
Configuration
object into the global
configuration. If a key/value pair with an identical already
exists in the global configuration, it is overwritten by the
pair of the Configuration
object.conf
- the Configuration
object to merge into the global configurationCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.