Interface Configuration
- All Known Implementing Classes:
ConfigurationProvider,MapConfiguration
public interface Configuration
Application configuration. Provides read-only or read-write access to
key-value pairs (either as
Keys or as arbitrary strings) in some
kind of underlying storage.-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears any key-value pairs from the instance (but not its persistent store, if available).default voidclearProperty(Key key) voidclearProperty(String key) Removes a single key-value pair from the instance (but not its persistent store, if available).static Configurationdefault booleangetBoolean(Key key) default booleangetBoolean(Key key, boolean defaultValue) booleangetBoolean(String key) booleangetBoolean(String key, boolean defaultValue) default doubledefault doubledoubledoublegetFile()default floatdefault floatfloatfloatdefault intdefault intintintgetKeys()default longdefault longlonglongdefault longgetLongBytes(Key key) default longgetLongBytes(Key key, long defaultValue) default longgetLongBytes(String key) default longgetLongBytes(String key, long defaultValue) default ObjectgetProperty(Key key) getProperty(String key) default Stringdefault Stringvoidreload()Reloads the configuration from its persistent store.default voidsetProperty(Key key, Object value) voidsetProperty(String key, Object value) toMap()This default implementation uses theIteratorreturned bygetKeys()in conjunction withgetProperty(String)to build a map.
-
Method Details
-
forApplication
- Returns:
- Global application configuration instance.
-
clear
void clear()Clears any key-value pairs from the instance (but not its persistent store, if available). -
clearProperty
- See Also:
-
clearProperty
Removes a single key-value pair from the instance (but not its persistent store, if available).- Parameters:
key- Key to remove.
-
getBoolean
- See Also:
-
getBoolean
-
getBoolean
- See Also:
-
getBoolean
- Returns:
- Boolean value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a boolean.
-
getDouble
-
getDouble
-
getDouble
- See Also:
-
getDouble
- Returns:
- Double value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a double.
-
getFile
-
getFloat
- See Also:
-
getFloat
-
getFloat
- See Also:
-
getFloat
- Returns:
- Float value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a float.
-
getInt
- See Also:
-
getInt
-
getInt
- See Also:
-
getInt
- Returns:
- Int value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to an int.
-
getKeys
-
getLong
- See Also:
-
getLong
-
getLong
- See Also:
-
getLong
- Returns:
- Long value corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a long.
-
getLongBytes
- See Also:
-
getLongBytes
-
getLongBytes
- See Also:
-
getLongBytes
- Returns:
- Byte size corresponding to the given key, or the given default value if the target value is null or cannot be coerced to a byte size.
- See Also:
-
getProperty
-
getProperty
-
getString
-
getString
-
getString
-
getString
-
reload
Reloads the configuration from its persistent store.- Throws:
IOException- if there is a physical problem reloading the configuration.ConfigurationException- if there is a logical problem reloading the configuration.
-
setProperty
-
setProperty
-
toMap
-