org.xwiki.configuration
Interface ConfigurationSource


@ComponentRole
public interface ConfigurationSource

Since:
1.6M1
Version:
$Id$

Method Summary
 boolean containsKey(String key)
           
 List<String> getKeys()
           
<T> T
getProperty(String key)
           
<T> T
getProperty(String key, Class<T> valueClass)
           
<T> T
getProperty(String key, T defaultValue)
           
 boolean isEmpty()
           
 

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 value
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:
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 value
valueClass - 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 the returned value depends on the passed valueClass:
  • String: null
  • Boolean: false
  • List: empty List
  • Properties: empty Properties
Since:
2.0M1

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) or getProperty(String, Object)

getKeys

List<String> getKeys()
Returns:
the list of available keys in the configuration source

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


Copyright © 2004-2011 XWiki. All Rights Reserved.