Interface ContainerConfiguration


public interface ContainerConfiguration
Container Configuration Retrieve basic data types from the container configuration(s). This is a subset of Commons Configuration functionality.
Version:
$Id$
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Check if the configuration contains the specified key.
    boolean
    Get a boolean associated with the given configuration key.
    boolean
    getBoolean(String key, boolean defaultValue)
    Get a boolean associated with the given configuration key.
    double
    Get a double associated with the given configuration key.
    double
    getDouble(String key, double defaultValue)
    Get a double associated with the given configuration key.
    float
    Get a float associated with the given configuration key.
    float
    getFloat(String key, float defaultValue)
    Get a float associated with the given configuration key.
    int
    Get a int associated with the given configuration key.
    int
    getInt(String key, int defaultValue)
    Get a int associated with the given configuration key.
    Get the list of the keys contained in the configuration.
    Get a List of strings associated with the given configuration key.
    long
    Get a long associated with the given configuration key.
    long
    getLong(String key, long defaultValue)
    Get a long associated with the given configuration key.
    Get a string associated with the given configuration key.
    getString(String key, String defaultValue)
    Get a string associated with the given configuration key.
    Get an array of strings associated with the given configuration key.
    boolean
    Checks if the container is running under development mode
    boolean
    Check if the configuration is empty.
    Convert a ContainerConfiguration class into a Properties class.
  • Method Details

    • isEmpty

      boolean isEmpty()
      Check if the configuration is empty.
      Returns:
      true if the configuration contains no property, false otherwise.
    • containsKey

      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
    • getBoolean

      boolean getBoolean(String key)
      Get a boolean associated with the given configuration key.
      Parameters:
      key -
      Returns:
      boolean associated for key and false if key is missing
      Throws:
      RuntimeException - if key is present but mapped to wrong type
    • getBoolean

      boolean getBoolean(String key, boolean defaultValue)
      Get a boolean associated with the given configuration key. If the key doesn't map to an existing object or to an object that is not a boolean/Boolean, the default value is returned.
      Parameters:
      key -
      defaultValue -
      Returns:
      boolean associated with configuration key and if key maps to object that does not map to a boolean/Boolean or is missing, defaultValue is returned
    • getString

      String getString(String key)
      Get a string associated with the given configuration key.
      Parameters:
      key -
      Returns:
      String associated for key and null if key is missing
      Throws:
      RuntimeException - if key is present but mapped to wrong type
    • getString

      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 or to an object that is not a String, the default value is returned.
      Parameters:
      key -
      defaultValue -
      Returns:
      String associated with configuration key and if key maps to object that does not map to a string or is missing, defaultValue is returned
    • getDouble

      double getDouble(String key)
      Get a double associated with the given configuration key.
      Parameters:
      key -
      Returns:
      double associated for key and 0D if key is missing
      Throws:
      RuntimeException - if key is present but mapped to wrong type
    • getDouble

      double getDouble(String key, double defaultValue)
      Get a double associated with the given configuration key. If the key doesn't map to an existing object or to an object that is not a double/Double, the default value is returned.
      Parameters:
      key -
      defaultValue -
      Returns:
      double associated with configuration key and if key maps to object that does not map to a double/Double or is missing, defaultValue is returned
    • getFloat

      float getFloat(String key)
      Get a float associated with the given configuration key.
      Parameters:
      key -
      Returns:
      float associated for key and 0F if key is missing
      Throws:
      RuntimeException - if key is present but mapped to wrong type
    • getFloat

      float getFloat(String key, float defaultValue)
      Get a float associated with the given configuration key. If the key doesn't map to an existing object or to an object that is not a float/Float, the default value is returned.
      Parameters:
      key -
      defaultValue -
      Returns:
      double associated with configuration key and if key maps to object that does not map to a float/Float or is missing, defaultValue is returned
    • getInt

      int getInt(String key)
      Get a int associated with the given configuration key.
      Parameters:
      key -
      Returns:
      int associated for key and 0 if key is missing
      Throws:
      RuntimeException - if key is present but mapped to wrong type
    • getInt

      int getInt(String key, int defaultValue)
      Get a int associated with the given configuration key. If the key doesn't map to an existing object or to an object that is not a int/Int, the default value is returned.
      Parameters:
      key -
      defaultValue -
      Returns:
      int associated with configuration key and if key maps to object that does not map to a int/Int or is missing, defaultValue is returned
    • getList

      List<String> getList(String key)
      Get a List of strings associated with the given configuration key.
      Parameters:
      key -
      Returns:
      List of Strings for key
    • getLong

      long getLong(String key)
      Get a long associated with the given configuration key.
      Parameters:
      key -
      Returns:
      long associated for key and 0L if key is missing
      Throws:
      RuntimeException - if key is present but mapped to wrong type
    • getLong

      long getLong(String key, long defaultValue)
      Get a long associated with the given configuration key. If the key doesn't map to an existing object or to an object that is not a long/Long, the default value is returned.
      Parameters:
      key -
      defaultValue -
      Returns:
      int associated with configuration key and if key maps to object that does not map to a long/Long or is missing, defaultValue is returned
    • getStringArray

      String[] getStringArray(String key)
      Get an array of strings associated with the given configuration key.
      Parameters:
      key -
    • getKeys

      Iterator<String> getKeys()
      Get the list of the keys contained in the configuration.
      Returns:
      Iterator of all the String keys
    • isDevelopmentMode

      boolean isDevelopmentMode()
      Checks if the container is running under development mode
    • toProperties

      Properties toProperties()

      Convert a ContainerConfiguration class into a Properties class. List properties are joined into a string using the delimiter of the configuration.

      modifications to the returned Properties object are not reflected in the ContainerConfiguration and only to the returned Properties: Every new invocation returns a new unique instance

      Returns:
      Properties created from the Configuration