Class BaseConfiguration

    • Field Detail

      • store

        private java.util.Map<java.lang.String,​java.lang.Object> store
        Stores the configuration key-value pairs
    • Constructor Detail

      • BaseConfiguration

        public BaseConfiguration()
    • Method Detail

      • addPropertyDirect

        protected void addPropertyDirect​(java.lang.String key,
                                         java.lang.Object value)
        Adds a key/value pair to the map. This routine does no magic morphing. It ensures the keylist is maintained
        Specified by:
        addPropertyDirect in class AbstractConfiguration
        Parameters:
        key - key to use for mapping
        value - object to store
      • clearInternal

        protected void clearInternal()
        Description copied from class: AbstractConfiguration
        Clears the whole configuration. This method is called by clear() after some preparations have been made. This base implementation uses the iterator provided by getKeys() to remove every single property. Subclasses should override this method if there is a more efficient way of clearing the configuration.
        Overrides:
        clearInternal in class AbstractConfiguration
      • clearPropertyDirect

        protected void clearPropertyDirect​(java.lang.String key)
        Clear a property in the configuration.
        Specified by:
        clearPropertyDirect in class AbstractConfiguration
        Parameters:
        key - the key to remove along with corresponding value.
      • clone

        public java.lang.Object clone()
        Creates a copy of this object. This implementation will create a deep clone, i.e. the map that stores the properties is cloned, too. So changes performed at the copy won't affect the original and vice versa.
        Overrides:
        clone in class BaseEventSource
        Returns:
        the copy
        Since:
        1.3
      • cloneStore

        private void cloneStore​(BaseConfiguration copy)
                         throws java.lang.CloneNotSupportedException
        Clones the internal map with the data of this configuration.
        Parameters:
        copy - the copy created by the clone() method
        Throws:
        java.lang.CloneNotSupportedException - if the map cannot be cloned
      • containsKeyInternal

        protected boolean containsKeyInternal​(java.lang.String key)
        check if the configuration contains the key
        Specified by:
        containsKeyInternal in class AbstractConfiguration
        Parameters:
        key - the configuration key
        Returns:
        true if Configuration contain given key, false otherwise.
      • containsValueInternal

        protected boolean containsValueInternal​(java.lang.Object value)
        Tests whether this configuration contains one or more matches to this value. This operation stops at first match but may be more expensive than the containsKey method.
        Specified by:
        containsValueInternal in class AbstractConfiguration
        Parameters:
        value - the value in question
        Returns:
        true if and only if some key maps to the value argument in this configuration as determined by the equals method; false otherwise.
        Since:
        2.11.0
      • getKeysInternal

        protected java.util.Iterator<java.lang.String> getKeysInternal()
        Gets the list of the keys contained in the configuration repository.
        Specified by:
        getKeysInternal in class AbstractConfiguration
        Returns:
        An Iterator.
      • getPropertyInternal

        protected java.lang.Object getPropertyInternal​(java.lang.String key)
        Read property from underlying map.
        Specified by:
        getPropertyInternal in class AbstractConfiguration
        Parameters:
        key - key to use for mapping
        Returns:
        object associated with the given configuration key.
      • isEmptyInternal

        protected boolean isEmptyInternal()
        Check if the configuration is empty
        Specified by:
        isEmptyInternal in class AbstractConfiguration
        Returns:
        true if Configuration is empty, false otherwise.
      • sizeInternal

        protected int sizeInternal()
        Actually calculates the size of this configuration. This method is called by size() with a read lock held. The base implementation provided here calculates the size based on the iterator returned by getKeys(). Sub classes which can determine the size in a more efficient way should override this method. This implementation obtains the size directly from the map used as data store. So this is a rather efficient implementation.
        Overrides:
        sizeInternal in class AbstractConfiguration
        Returns:
        the size of this configuration (i.e. the number of keys)