Package org.xwiki.configuration
Interface ConfigurationSource
- Since:
- 1.6M1
- Version:
- $Id: f83d066e2677b38b07cd2e9570314c194ab6b501 $
-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(String key) getKeys()<T> TgetProperty(String key) <T> TgetProperty(String key, Class<T> valueClass) default <T> TgetProperty(String key, Class<T> valueClass, T defaultValue) <T> TgetProperty(String key, T defaultValue) booleanisEmpty()default voidsetProperties(Map<String, Object> properties) default voidsetProperty(String key, Object value) Set a property, this will replace any previously set values.
-
Method Details
-
getProperty
- 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
- 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
- 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
- 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)
-
getKeys
- Returns:
- the list of available keys in the configuration source
-
containsKey
- 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
-
setProperty
Set a property, this will replace any previously set values.- Parameters:
key- The key of the property to changevalue- The new value- Throws:
ConfigurationSaveException- when an error occurs during persistence- Since:
- 15.9, 15.5.4, 14.10.19
-
setProperties
- Parameters:
properties- the set of properties to persist- Throws:
ConfigurationSaveException- when an error occurs during persistence- Since:
- 12.4RC1
-