Interface Configuration

All Known Subinterfaces:
InstanceConfiguration
All Known Implementing Classes:
AbstractApacheConfiguration, GlobalApacheConfiguration, InstanceApacheConfiguration

public interface Configuration
Container for a configuration.
Author:
Dustin Frisch <fooker@lab.sh>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addProperty(String key, String string)
     
    boolean
    Check if the configuration contains the specified key.
    Returns the path to the configuration.
    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.
    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 path associated with the given configuration key.
    getPath(String key, Path defaultValue)
    Get a path associated with the given configuration key.
    Get all paths 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
    Check if the configuration is empty.
  • Method Details

    • getBasePath

      Path getBasePath()
      Returns the path to the configuration.
      Returns:
      the absolute path to the configuration folder.
    • 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 - The configuration key
      Returns:
      The associated boolean
    • 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, the default value is returned.
      Parameters:
      key - The configuration key
      defaultValue - The default value
      Returns:
      The associated boolean
    • getInt

      int getInt(String key)
      Get a int associated with the given configuration key.
      Parameters:
      key - The configuration key
      Returns:
      The associated int
    • 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, the default value is returned.
      Parameters:
      key - The configuration key
      defaultValue - The default value
      Returns:
      The associated int
    • getPath

      Path getPath(String key)
      Get a path associated with the given configuration key. The returned path is resolved to the base directory of the instance configuration.
      Parameters:
      key - The configuration key
      Returns:
      The associated path
    • getPaths

      List<Path> getPaths(String key)
      Get all paths associated with the given configuration key. The returned paths are resolved to the base directory of the instance configuration.
      Parameters:
      key - The configuration key
      Returns:
      A List of the associated paths
    • getPath

      Path getPath(String key, Path defaultValue)
      Get a path associated with the given configuration key. If the key doesn't map to an existing object, the default value is returned. The returned path is resolved to the base directory if the instance configuration.
      Parameters:
      key - The configuration key
      defaultValue - The default value
      Returns:
      The associated path if key is found and has valid format, default value otherwise
    • getString

      String getString(String key)
      Get a string associated with the given configuration key.
      Parameters:
      key - The configuration key
      Returns:
      The associated string
    • 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, 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
    • getStringArray

      String[] getStringArray(String key)
      Get an array of strings associated with the given configuration key. If the key doesn't map to an existing object an empty array is returned.
      Parameters:
      key - The configuration key
      Returns:
      The associated string array if key is found
    • getKeys

      Iterator<String> getKeys()
      Get the list of the keys contained in the configuration. The returned iterator can be used to obtain all defined keys. Note that the exact behavior of the iterator's remove() method is specific to a concrete implementation. It may remove the corresponding property from the configuration, but this is not guaranteed. In any case it is no replacement for calling clearProperty(String) for this property. So it is highly recommended to avoid using the iterator's remove() method.
      Returns:
      An Iterator.
    • addProperty

      void addProperty(String key, String string)