Interface ConfigurationSource


@Role public interface ConfigurationSource
Since:
1.6M1
Version:
$Id: f83d066e2677b38b07cd2e9570314c194ab6b501 $
  • Method Details

    • 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, 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 value
      valueClass - 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) 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
    • setProperty

      default void setProperty(String key, Object value) throws ConfigurationSaveException
      Set a property, this will replace any previously set values.
      Parameters:
      key - The key of the property to change
      value - The new value
      Throws:
      ConfigurationSaveException - when an error occurs during persistence
      Since:
      15.9, 15.5.4, 14.10.19
    • 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