Class ExtendedConfigurationWrapper

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Returns a clone of this instance.
      java.util.Iterator findPropertyKeys​(java.lang.String prefix)
      Returns all keys with the given prefix.
      boolean getBoolProperty​(java.lang.String name)
      Returns the boolean value of a given configuration property.
      boolean getBoolProperty​(java.lang.String name, boolean defaultValue)
      Returns the boolean value of a given configuration property.
      java.util.Enumeration getConfigProperties()
      Returns an enumeration of the configuration properties.
      java.lang.String getConfigProperty​(java.lang.String key)
      Returns the configuration property with the specified key.
      java.lang.String getConfigProperty​(java.lang.String key, java.lang.String defaultValue)
      Returns the configuration property with the specified key (or the specified default value if there is no such property).
      int getIntProperty​(java.lang.String name)
      Returns a given property as int value.
      int getIntProperty​(java.lang.String name, int defaultValue)
      Returns a given property as int value.
      boolean isPropertySet​(java.lang.String name)
      Checks, whether a given property is defined.
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExtendedConfigurationWrapper

        public ExtendedConfigurationWrapper​(Configuration parent)
        Creates a wrapper around the given configuration.
        Parameters:
        parent - the wrapped up configuration.
        Throws:
        java.lang.NullPointerException - if the parent is null.
    • Method Detail

      • getBoolProperty

        public boolean getBoolProperty​(java.lang.String name)
        Returns the boolean value of a given configuration property. The boolean value true is returned, if the contained string is equal to 'true'.
        Specified by:
        getBoolProperty in interface ExtendedConfiguration
        Parameters:
        name - the name of the property
        Returns:
        the boolean value of the property.
      • getBoolProperty

        public boolean getBoolProperty​(java.lang.String name,
                                       boolean defaultValue)
        Returns the boolean value of a given configuration property. The boolean value true is returned, if the contained string is equal to 'true'. If the property is not set, the default value is returned.
        Specified by:
        getBoolProperty in interface ExtendedConfiguration
        Parameters:
        name - the name of the property
        defaultValue - the default value to be returned if the property is not set
        Returns:
        the boolean value of the property.
      • getIntProperty

        public int getIntProperty​(java.lang.String name)
        Returns a given property as int value. Zero is returned if the property value is no number or the property is not set.
        Specified by:
        getIntProperty in interface ExtendedConfiguration
        Parameters:
        name - the name of the property
        Returns:
        the parsed number value or zero
      • getIntProperty

        public int getIntProperty​(java.lang.String name,
                                  int defaultValue)
        Returns a given property as int value. The specified default value is returned if the property value is no number or the property is not set.
        Specified by:
        getIntProperty in interface ExtendedConfiguration
        Parameters:
        name - the name of the property
        defaultValue - the value to be returned if the property is no integer value
        Returns:
        the parsed number value or the specified default value
      • isPropertySet

        public boolean isPropertySet​(java.lang.String name)
        Checks, whether a given property is defined.
        Specified by:
        isPropertySet in interface ExtendedConfiguration
        Parameters:
        name - the name of the property
        Returns:
        true, if the property is defined, false otherwise.
      • findPropertyKeys

        public java.util.Iterator findPropertyKeys​(java.lang.String prefix)
        Returns all keys with the given prefix.
        Specified by:
        findPropertyKeys in interface Configuration
        Parameters:
        prefix - the prefix
        Returns:
        the iterator containing all keys with that prefix
      • getConfigProperty

        public java.lang.String getConfigProperty​(java.lang.String key)
        Returns the configuration property with the specified key.
        Specified by:
        getConfigProperty in interface Configuration
        Parameters:
        key - the property key.
        Returns:
        the property value.
      • getConfigProperty

        public java.lang.String getConfigProperty​(java.lang.String key,
                                                  java.lang.String defaultValue)
        Returns the configuration property with the specified key (or the specified default value if there is no such property).

        If the property is not defined in this configuration, the code will lookup the property in the parent configuration.

        Specified by:
        getConfigProperty in interface Configuration
        Parameters:
        key - the property key.
        defaultValue - the default value.
        Returns:
        the property value.
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Returns a clone of this instance.
        Specified by:
        clone in interface Configuration
        Overrides:
        clone in class java.lang.Object
        Returns:
        A clone.
        Throws:
        java.lang.CloneNotSupportedException - if there is a problem cloning.