Interface Configuration

All Known Implementing Classes:
BaseConfiguration, PropertiesConfiguration

public interface Configuration
Configuration interface which provides a hierarchical view of the configuration values that we need to handle.
  • Method Details

    • getBlockKeys

      Set<String> getBlockKeys(String key) throws ConfigurationException
      Gets all the lower-level keys for a given block in the configuration that are blocks of configuration (that is, not 'leaf' values). If 'key' is null or empty it will refer to the main configuration.
      Parameters:
      key - the key to the section of the configuration we're interested in.
      Returns:
      a set of String keys for the block (or an empty set if there are none)
      Throws:
      ConfigurationException - if the key refers to a 'leaf' value, not a block
    • getBlockKeys

      Set<String> getBlockKeys() throws ConfigurationException
      Gets all the lower-level keys for the current configuration that are blocks of configuration (that is, not 'leaf' values).
      Returns:
      a set of String keys for the block (or an empty set if there are none)
      Throws:
      ConfigurationException - if the key refers to a 'leaf' value, not a block
    • getValueKeys

      Set<String> getValueKeys(String key) throws ConfigurationException
      Gets the keys for 'leaf' values for a given location in the configuration hierarchy (that is, not 'blocks')
      Parameters:
      key - the key to the section of the configuration we're interested in.
      Returns:
      a set of String keys for the values.
      Throws:
      ConfigurationException - if the key requested is not a block in the configuration.
    • getValueKeys

      Set<String> getValueKeys() throws ConfigurationException
      Gets the keys for 'leaf' values for the current location in the configuration hierarchy (that is, not 'blocks').
      Returns:
      a set of String keys for the values.
      Throws:
      ConfigurationException - if the key requested is not a block in the configuration.
    • getOptionalBlock

      Configuration getOptionalBlock(String key) throws ConfigurationException
      Attempt to get a block of configuration for the key provided (without raising an error if it does not exist)
      Parameters:
      key - the key to the section of the configuration we're interested in.
      Returns:
      a pointer to the Configuration or null if it does not exist.
      Throws:
      ConfigurationException - if the key requested is not a block in the configuration (i.e. it is a 'leaf value').
    • getBlock

      Attempt to get a block of configuration for the key provided (raise an error if it does not exist)
      Parameters:
      key - the key to the section of the configuration we're interested in.
      Returns:
      a pointer to the Configuration.
      Throws:
      ConfigurationException - if the key requested is not a block in the configuration or does not exist.
    • getOptionalInteger

      Integer getOptionalInteger(String key, Integer defValue) throws ConfigurationException
      Attempt to get an integer from the configuration for the key provided (and default to a given value if not found)
      Parameters:
      key - the key to the configuration entity we're interested in.
      defValue - the default value to use if the key value is not found.
      Returns:
      The integer value of the configuration parameter or the default value if not found
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not an integer
    • getOptionalInteger

      Integer getOptionalInteger(String key) throws ConfigurationException
      Attempt to get an integer from the configuration for the key provided.
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The integer value of the configuration parameter (or null if not found).
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, is not an integer.
    • getInteger

      Integer getInteger(String key) throws ConfigurationException
      Attempt to get an integer from the configuration for the key provided
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The integer value of the configuration parameter.
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not an integer, or is not found
    • getOptionalLong

      Long getOptionalLong(String key, Long defValue) throws ConfigurationException
      Attempt to get a long from the configuration for the key provided (and default to a given value if not found)
      Parameters:
      key - the key to the configuration entity we're interested in.
      defValue - the default value to use if the key value is not found.
      Returns:
      The long value of the configuration parameter or the default value if not found
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not a long
    • getOptionalLong

      Long getOptionalLong(String key) throws ConfigurationException
      Attempt to get a long from the configuration for the key provided.
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The long value of the configuration parameter (or null if not found).
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, is not a long.
    • getLong

      Long getLong(String key) throws ConfigurationException
      Attempt to get a long from the configuration for the key provided
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The long value of the configuration parameter.
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not a long, or is not found
    • getOptionalBoolean

      Boolean getOptionalBoolean(String key, Boolean defValue) throws ConfigurationException
      Attempt to get a Boolean from the configuration for the key provided (and default to a given value if not found)
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The boolean value of the configuration parameter or the default value (if not found)
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not a boolean
    • getOptionalBoolean

      Boolean getOptionalBoolean(String key) throws ConfigurationException
      Attempt to get a Boolean from the configuration for the key provided.
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The boolean value of the configuration parameter or null if not found
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not a boolean
    • getBoolean

      Boolean getBoolean(String key) throws ConfigurationException
      Attempt to get a boolean from the configuration for the key provided.
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The boolean value of the configuration parameter or null if not found
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not a boolean
    • getString

      String getString(String key) throws ConfigurationException
      Attempt to get a string from the configuration for the key provided.
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The string value of the configuration parameter
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not found
    • getOptionalString

      String getOptionalString(String key, String defValue) throws ConfigurationException
      Attempt to get a string from the configuration for the key provided (and default to a given value if not found)
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The string value of the configuration parameter (or the default value if not found)
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not a string
    • getOptionalString

      String getOptionalString(String key) throws ConfigurationException
      Attempt to get a string from the configuration for the key provided.
      Parameters:
      key - the key to the configuration entity we're interested in.
      Returns:
      The string value of the configuration parameter (or null if not found)
      Throws:
      ConfigurationException - if the key requested is not a value in the configuration, or is not a string
    • toString

      String toString()
      Get a pretty-printed string representation of the configuration object.
      Overrides:
      toString in class Object
      Returns:
      the string representation of the configuration in hierarchical form.
    • toProperties

      Properties toProperties()
      Return a set of configuration as a Properties object
      Returns:
      A Properties object for this section of configuration