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
Key
s or as arbitrary strings) in some
kind of underlying storage.-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears any key-value pairs from the instance (but not its persistent store, if available).default void
clearProperty
(Key key) void
clearProperty
(String key) Removes a single key-value pair from the instance (but not its persistent store, if available).static Configuration
default boolean
getBoolean
(Key key) default boolean
getBoolean
(Key key, boolean defaultValue) boolean
getBoolean
(String key) boolean
getBoolean
(String key, boolean defaultValue) default double
default double
double
double
getFile()
default float
default float
float
float
default int
default int
int
int
getKeys()
default long
default long
long
long
default long
getLongBytes
(Key key) default long
getLongBytes
(Key key, long defaultValue) default long
getLongBytes
(String key) default long
getLongBytes
(String key, long defaultValue) default Object
getProperty
(Key key) getProperty
(String key) default String
default String
void
reload()
Reloads the configuration from its persistent store.default void
setProperty
(Key key, Object value) void
setProperty
(String key, Object value) toMap()
This default implementation uses theIterator
returned 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
-