Package org.opennms.pris.api
Interface Configuration
- All Known Subinterfaces:
InstanceConfiguration
- All Known Implementing Classes:
AbstractApacheConfiguration
,GlobalApacheConfiguration
,InstanceApacheConfiguration
public interface Configuration
Container for a configuration.
- Author:
- Dustin Frisch <fooker@lab.sh>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addProperty
(String key, String string) boolean
containsKey
(String key) Check if the configuration contains the specified key.Returns the path to the configuration.boolean
getBoolean
(String key) Get a boolean associated with the given configuration key.boolean
getBoolean
(String key, boolean defaultValue) Get a boolean associated with the given configuration key.int
Get a int associated with the given configuration key.int
Get a int associated with the given configuration key.getKeys()
Get the list of the keys contained in the configuration.Get a path associated with the given configuration key.Get a path associated with the given configuration key.Get all paths associated with the given configuration key.Get a string associated with the given configuration key.Get a string associated with the given configuration key.String[]
getStringArray
(String key) Get an array of strings associated with the given configuration key.boolean
isEmpty()
Check if the configuration is empty.
-
Method Details
-
getBasePath
Path getBasePath()Returns the path to the configuration.- Returns:
- the absolute path to the configuration folder.
-
isEmpty
boolean isEmpty()Check if the configuration is empty.- Returns:
true
if the configuration contains no property,false
otherwise
-
containsKey
Check if the configuration contains the specified key.- Parameters:
key
- the key whose presence in this configuration is to be tested- Returns:
- true if the configuration contains a value for this key, false otherwise
-
getBoolean
Get a boolean associated with the given configuration key.- Parameters:
key
- The configuration key- Returns:
- The associated boolean
-
getBoolean
Get a boolean associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Parameters:
key
- The configuration keydefaultValue
- The default value- Returns:
- The associated boolean
-
getInt
Get a int associated with the given configuration key.- Parameters:
key
- The configuration key- Returns:
- The associated int
-
getInt
Get a int associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Parameters:
key
- The configuration keydefaultValue
- The default value- Returns:
- The associated int
-
getPath
Get a path associated with the given configuration key. The returned path is resolved to the base directory of the instance configuration.- Parameters:
key
- The configuration key- Returns:
- The associated path
-
getPaths
Get all paths associated with the given configuration key. The returned paths are resolved to the base directory of the instance configuration.- Parameters:
key
- The configuration key- Returns:
- A List of the associated paths
-
getPath
Get a path associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned. The returned path is resolved to the base directory if the instance configuration.- Parameters:
key
- The configuration keydefaultValue
- The default value- Returns:
- The associated path if key is found and has valid format, default value otherwise
-
getString
Get a string associated with the given configuration key.- Parameters:
key
- The configuration key- Returns:
- The associated string
-
getString
Get a string associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned.- Parameters:
key
- The configuration keydefaultValue
- The default value- Returns:
- The associated string if key is found and has valid format, default value otherwise
-
getStringArray
Get an array of strings associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.- Parameters:
key
- The configuration key- Returns:
- The associated string array if key is found
-
getKeys
Get the list of the keys contained in the configuration. The returned iterator can be used to obtain all defined keys. Note that the exact behavior of the iterator'sremove()
method is specific to a concrete implementation. It may remove the corresponding property from the configuration, but this is not guaranteed. In any case it is no replacement for callingclearProperty(String)
for this property. So it is highly recommended to avoid using the iterator'sremove()
method.- Returns:
- An Iterator.
-
addProperty
-