Package org.xwiki.configuration
Interface ConfigurationSource
-
@Role public interface ConfigurationSource
- Since:
- 1.6M1
- Version:
- $Id: 457bc28688d50e189a7839631f7b04c111fc4518 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
containsKey(String key)
List<String>
getKeys()
<T> T
getProperty(String key)
<T> T
getProperty(String key, Class<T> valueClass)
default <T> T
getProperty(String key, Class<T> valueClass, T defaultValue)
<T> T
getProperty(String key, T defaultValue)
boolean
isEmpty()
default void
setProperties(Map<String,Object> properties)
-
-
-
Method Detail
-
getProperty
<T> T getProperty(String key, T defaultValue)
- Type Parameters:
T
- the value type- Parameters:
key
- the property key for which we want the valuedefaultValue
- the value to use if the key isn't found- Returns:
- the property value is found or the default value if the key wasn't found
- Since:
- 2.0M1
-
getProperty
<T> T getProperty(String key, Class<T> valueClass)
- Type Parameters:
T
- the value type- Parameters:
key
- the property key for which we want the valuevalueClass
- the type of object that should be returned. The value is converted to the passed type.- Returns:
- the property value is found. If the key wasn't found, null is returned except for the following special
cases:
- List: empty List
- Properties: empty Properties
- Since:
- 2.0M1
-
getProperty
default <T> T getProperty(String key, Class<T> valueClass, T defaultValue)
- Type Parameters:
T
- the value type- Parameters:
key
- the property key for which we want the valuevalueClass
- the type of object that should be returned. The value is converted to the passed type.defaultValue
- the value to use if the key isn't found- Returns:
- the property value is found or the default value if the key wasn't found.
- Since:
- 12.0RC1
-
getProperty
<T> T getProperty(String key)
- Type Parameters:
T
- the value type- Parameters:
key
- the property key for which we want the value- Returns:
- the property as an untyped Object or null if the key wasn't found. In general you should prefer
getProperty(String, Class)
orgetProperty(String, Object)
-
containsKey
boolean containsKey(String key)
- Parameters:
key
- the key to check- Returns:
- true if the key is present in the configuration source or false otherwise
-
isEmpty
boolean isEmpty()
- Returns:
- true if the configuration source doesn't have any key or false otherwise
-
setProperties
default void setProperties(Map<String,Object> properties) throws ConfigurationSaveException
- Parameters:
properties
- the set of properties to persist- Throws:
ConfigurationSaveException
- when an error occurs during persistence- Since:
- 12.4RC1
-
-