Interface Configuration

All Known Subinterfaces:
DynamicConfiguration
All Known Implementing Classes:
AbstractDynamicConfiguration, CompositeConfiguration, CompositeDynamicConfiguration, ConfigConfigurationAdapter, EnvironmentConfiguration, InmemoryConfiguration, NopDynamicConfiguration, OrderedPropertiesConfiguration, PrefixedConfiguration, PropertiesConfiguration, SystemConfiguration, TreePathDynamicConfiguration

public interface Configuration
Configuration interface, to fetch the value for the specified key.
  • Field Details

  • Method Details

    • getString

      default String getString(String key)
      Get a string associated with the given configuration key.
      Parameters:
      key - The configuration key.
      Returns:
      The associated string.
    • getString

      default String getString(String key, String defaultValue)
      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 key.
      defaultValue - The default value.
      Returns:
      The associated string if key is found and has valid format, default value otherwise.
    • getInt

      default int getInt(String key)
    • getInt

      default int getInt(String key, int defaultValue)
    • getInteger

      default Integer getInteger(String key, Integer defaultValue)
    • getBoolean

      default boolean getBoolean(String key)
    • getBoolean

      default boolean getBoolean(String key, boolean defaultValue)
    • getBoolean

      default Boolean getBoolean(String key, Boolean defaultValue)
    • getProperty

      default Object getProperty(String key)
      Gets a property from the configuration. This is the most basic get method for retrieving values of properties. In a typical implementation of the Configuration interface the other get methods (that return specific data types) will internally make use of this method. On this level variable substitution is not yet performed. The returned object is an internal representation of the property value for the passed in key. It is owned by the Configuration object. So a caller should not modify this object. It cannot be guaranteed that this object will stay constant over time (i.e. further update operations on the configuration may change its internal state).
      Parameters:
      key - property to retrieve
      Returns:
      the value to which this configuration maps the specified key, or null if the configuration contains no mapping for this key.
    • getProperty

      default Object getProperty(String key, Object defaultValue)
      Gets a property from the configuration. The default value will return if the configuration doesn't contain the mapping for the specified key.
      Parameters:
      key - property to retrieve
      defaultValue - default value
      Returns:
      the value to which this configuration maps the specified key, or default value if the configuration contains no mapping for this key.
    • getInternalProperty

      Object getInternalProperty(String key)
    • containsKey

      default boolean containsKey(String key)
      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
    • convert

      default <T> T convert(Class<T> cls, String key, T defaultValue)
    • toBooleanObject

      static Boolean toBooleanObject(boolean bool)