Interface Configuration

    • Method Detail

      • subset

        Configuration subset​(String prefix)
        Return a decorator Configuration containing every key from the current Configuration that starts with the specified prefix. The prefix is removed from the keys in the subset. For example, if the configuration contains the following properties:
            prefix.number = 1
            prefix.string = Apache
   = bar
            prefix = Jakarta
        the Configuration returned by subset("prefix") will contain the properties:
            number = 1
            string = Apache
            = Jakarta
        (The key for the value "Jakarta" is an empty string)

        Since the subset is a decorator and not a modified copy of the initial Configuration, any change made to the subset is available to the Configuration, and reciprocally.

        prefix - The prefix used to select the properties.
        a subset configuration
        See Also:
      • addProperty

        void addProperty​(String key,
                         Object value)
        Add a property to the configuration. If it already exists then the value stated here will be added to the configuration entry. For example, if the property:
         resource.loader = file
        is already present in the configuration and you call
         addProperty("resource.loader", "classpath")
        Then you will end up with a List like the following:
         ["file", "classpath"]
        key - The key to add the property to.
        value - The value to add.
      • setProperty

        void setProperty​(String key,
                         Object value)
        Set a property, this will replace any previously set values. Set values is implicitly a call to clearProperty(key), addProperty(key, value).
        key - The key of the property to change
        value - The new value
      • clearProperty

        void clearProperty​(String key)
        Remove a property from the configuration.
        key - the key to remove along with corresponding value.
      • clear

        void clear()
        Remove all properties from the configuration.
      • getInterpolator

        ConfigurationInterpolator getInterpolator()
        Gets the ConfigurationInterpolator object used by this Configuration. This object is responsible for variable substitution.
        the ConfigurationInterpolator (can be null)
      • setInterpolator

        void setInterpolator​(ConfigurationInterpolator ci)
        Sets the ConfigurationInterpolator object to be used by this Configuration. This object is invoked for each access of a string property in order to substitute variables which may be contained. The argument can be null to disable interpolation at all.
        ci - the new ConfigurationInterpolator
      • installInterpolator

        void installInterpolator​(Map<String,​? extends Lookup> prefixLookups,
                                 Collection<? extends Lookup> defLookups)
        Creates and installs a new ConfigurationInterpolator for this Configuration based on the passed in arguments. This method creates a default ConfigurationInterpolator instance and initializes it with the passed in Lookup objects. It also adds a special default Lookup object that tries to resolve variables by matching them with properties contained in this Configuration. This is also the main difference to the setInterpolator(ConfigurationInterpolator) method which sets the passed in object as is without adding this special lookup.
        prefixLookups - the map with Lookup objects associated with specific prefixes (can be null)
        defLookups - a collection with default Lookup objects (can be null)
        See Also: