Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Kieker 1.10
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## kieker.common.configuration
Class Configuration

    java.lang.Object
      java.util.Dictionary<K,V>
          java.util.Hashtable<Object,Object>
              java.util.Properties
                  kieker.common.configuration.Configuration

All Implemented Interfaces:
  Serializable, Cloneable, Map<Object,Object>

    public final class Configuration

extends Properties

This class represents a configuration object within the Kieker project. Technically it is a property list with some additional methods and possibilities.
Some of the methods are marked as deprecated. This is not because they will be removed, but rather because they should not be used anymore (at least not directly - they are still used in a valid way within this class). Normally we would remove them, but they are inherited from the class `Properties` and can neither be removed nor get a lower visibility modificator.

Since:
  1.5
Author:
  Jan Waller
See Also:
  Serialized Form

Constructor Summary
`Configuration()` Creates a new (empty) configuration.
`Configuration(Properties defaults)` Creates a new instance of this class using the given parameters.

Method Summary
`static String` | `convertToPath(String pathname)` Based upon Guava 14.0.1 (Chris Nokleberg, Colin Decker).
`Configuration` | `flatten()` Flattens the Properties hierarchies and returns a new Configuration object.
`Configuration` | `flatten(Configuration defaultConfiguration)` Flattens the Properties hierarchies and returns a new Configuration object.
`void` | `flattenInPlace()` Flattens the Properties hierarchies with this Configuration.
`Object` | `get(Object key)` Deprecated. This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method directly.
`boolean` | `getBooleanProperty(String key)` Reads the given property from the configuration and interprets it as a boolean.
`double` | `getDoubleProperty(String key)` Reads the given property from the configuration and interprets it as a double.
`int` | `getIntProperty(String key)` Reads the given property from the configuration and interprets it as an integer.
`long` | `getLongProperty(String key)` Reads the given property from the configuration and interprets it as a long.
`String` | `getPathProperty(String key)` Reads the given property from the configuration and interprets it as a path.
`Configuration` | `getPropertiesStartingWith(String prefix)` Flattens the Properties hierarchies and returns a Configuration object containing only keys starting with the prefix.
`String` | `getProperty(String key)` Deprecated. This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method directly.
`String` | `getProperty(String key, String defaultValue)` Deprecated. This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method directly.
`String[]` | `getStringArrayProperty(String key)` Interprets the property (defined by the given key) as an array of values and transforms it into a real array.
`String[]` | `getStringArrayProperty(String key, String split)` Interprets the property (defined by the given key) as an array of values and transforms it into a real array.
`String` | `getStringProperty(String key)` Reads the given property from the configuration and interprets it as a string.
`Object` | `put(Object key, Object value)` Deprecated. This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method directly.
`void` | `setDefaultConfiguration(Configuration defaultConfiguration)` You should know what you do if you use this method! Currently it is used for a (dirty) hack to add default configurations to Writers or AnalysisPlugins.
`void` | `setStringArrayProperty(String key, String[] value)` Sets a property to the given string array.
`static String` | `toProperty(Object[] values)` Converts the Object[] to a String split by '|'.

Methods inherited from class java.util.Properties
`list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames`

Methods inherited from class java.util.Hashtable
`clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, hashCode, isEmpty, keys, keySet, putAll, remove, size, toString, values`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Configuration

    public Configuration()

  Creates a new (empty) configuration.

### Configuration

    public Configuration(Properties defaults)

  Creates a new instance of this class using the given parameters.

  Parameters:
    `defaults` - The property object which delivers the default values for the new configuration.

Method Detail

### getStringProperty

    public final String getStringProperty(String key)

  Reads the given property from the configuration and interprets it as a string.

  Parameters:
    `key` - The key of the property.
  Returns:
    A string with the value of the given property or null, if the property does not exist.

### getBooleanProperty

    public final boolean getBooleanProperty(String key)

  Reads the given property from the configuration and interprets it as a boolean.

  Parameters:
    `key` - The key of the property.
  Returns:
    A boolean with the value of the given property or null, if the property does not exist.

### getIntProperty

    public final int getIntProperty(String key)

  Reads the given property from the configuration and interprets it as an integer.

  Parameters:
    `key` - The key of the property.
  Returns:
    An integer with the value of the given property or null, if the property does not exist.

### getLongProperty

    public final long getLongProperty(String key)

  Reads the given property from the configuration and interprets it as a long.

  Parameters:
    `key` - The key of the property.
  Returns:
    A long with the value of the given property or null, if the property does not exist.

### getDoubleProperty

    public final double getDoubleProperty(String key)

  Reads the given property from the configuration and interprets it as a double.

  Parameters:
    `key` - The key of the property.
  Returns:
    A long with the value of the given property or null, if the property does not exist.

### getPathProperty

    public final String getPathProperty(String key)

  Reads the given property from the configuration and interprets it as a path.

  Parameters:
    `key` - The key of the property.
  Returns:
    A string with the value of the given property or null, if the property does not exist.

### getStringArrayProperty

    public final String[] getStringArrayProperty(String key)

  Interprets the property (defined by the given key) as an array of values and transforms it into a real array. Property values have to be split by '|'.

  Parameters:
    `key` - The key of the property.
  Returns:
    A string array containing the single values of the properties.

### setStringArrayProperty

    public final void setStringArrayProperty(String key,
                                             String[] value)

  Sets a property to the given string array. Note that the values must not contain the separator character '|'.

  Parameters:
    `key` - The key of the property to change
    `value` - The array to set

### getStringArrayProperty

    public final String[] getStringArrayProperty(String key,
                                                 String split)

  Interprets the property (defined by the given key) as an array of values and transforms it into a real array. Property values have to be split by 'split'.

  Parameters:
    `split` - a regular expression
    `key` - The key of the property.
  Returns:
    A string array containing the single values of the properties.
  See Also:
    `toProperty(Object[])`

### toProperty

    public static final String toProperty(Object[] values)

  Converts the Object[] to a String split by '|'.

  Parameters:
    `values` - The values which will be transformed into a string.
  Returns:
    A string representation of the given values array.
  See Also:
    `getStringArrayProperty(String)`, `getStringArrayProperty(String, String)`

### convertToPath

    public static final String convertToPath(String pathname)

  Based upon Guava 14.0.1 (Chris Nokleberg, Colin Decker). Guava is licensed under "The Apache Software License, Version 2.0".
  Simplifies a given file system path.

  Parameters:
    `pathname` - The path to be simplified.
  Returns:
    A simplified version of the given path.

### getPropertiesStartingWith

    public final Configuration getPropertiesStartingWith(String prefix)

  Flattens the Properties hierarchies and returns a Configuration object containing only keys starting with the prefix.

  Parameters:
    `prefix` - The prefix to be used during the flattening.
  Returns:
    A new configuration object with a flattened properties hierarchy.

### flatten

    public final Configuration flatten(Configuration defaultConfiguration)

  Flattens the Properties hierarchies and returns a new Configuration object.

  Parameters:
    `defaultConfiguration` - The configuration which will be used as a base.
  Returns:
    A new configuration object with a flattened properties hierarchy.

### flatten

    public final Configuration flatten()

  Flattens the Properties hierarchies and returns a new Configuration object.

  Returns:
    A new configuration object with a flattened properties hierarchy.

### flattenInPlace

    public final void flattenInPlace()

  Flattens the Properties hierarchies with this Configuration. Afterwards, all Properties will still be present and defaults will be null.

### setDefaultConfiguration

    public final void setDefaultConfiguration(Configuration defaultConfiguration)

  You should know what you do if you use this method! Currently it is used for a (dirty) hack to add default configurations to Writers or AnalysisPlugins.

  Parameters:
    `defaultConfiguration` - The default configuration for this configuration object.

### put

    @Deprecated
    public final Object put(Object key,
                                       Object value)

  Deprecated. This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method directly.

  Puts a given key value pair into the container. This method should never be used directly! Use `Properties.setProperty(String, String)` instead!

  Specified by:
    `put` in interface `Map<Object,Object>`
  Overrides:
    `put` in class `Hashtable<Object,Object>`
  Parameters:
    `key` - The key which will be used to store the given value.
    `value` - The value to store.
  Returns:
    The old object which was stored under the given key or null if there wasn't a value before.

### get

    @Deprecated
    public final Object get(Object key)

  Deprecated. This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method directly.

  Searches for a given key. This method should never be used directly! Use `getStringProperty(String)` instead!

  Specified by:
    `get` in interface `Map<Object,Object>`
  Overrides:
    `get` in class `Hashtable<Object,Object>`
  Parameters:
    `key` - The key for the value in question.
  Returns:
    The value for the specified key if available, null otherwise.

### getProperty

    @Deprecated
    public final String getProperty(String key)

  Deprecated. This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method directly.

  Searches for a given property key. This method should never be used directly! Use `getStringProperty(String)` instead!

  Overrides:
    `getProperty` in class `Properties`
  Parameters:
    `key` - The key for the property in question.
  Returns:
    The property for the specified key if available, null otherwise.

### getProperty

    @Deprecated
    public final String getProperty(String key,
                                               String defaultValue)

  Deprecated. This method will not be removed (as this is for technical reasons not possible), but should only be used within this class. Don't call this method directly.

  Searches for a given property key. This method should never be used directly!

  Overrides:
    `getProperty` in class `Properties`
  Parameters:
    `key` - The key for the property in question.
    `defaultValue` - The default value to be returned.
  Returns:
    The property for the specified key if available, the given default value otherwise.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Kieker 1.10
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2014 Kieker Project, http://kieker-monitoring.net