Class Configuration


  • public class Configuration
    extends Object
    This class is a wrapper for configuration settings of Things.
    Author:
    Dennis Nobel - Initial contribution, Kai Kreuzer - added constructors and normalization, Gerhard Riegler - added converting BigDecimal values to the type of the configuration class field, Chris Jackson - fix concurrent modification exception when removing properties, Markus Rathgeb - add copy constructor, Michael Riess - fix concurrent modification exception when setting properties, Michael Riess - fix equals() implementation
    • Constructor Detail

      • Configuration

        public Configuration()
      • Configuration

        public Configuration​(@Nullable Configuration configuration)
        Create a new configuration.

        The new configuration is initialized with the values of the given configuration.

        Parameters:
        configuration - the configuration that should be cloned (may be null)
      • Configuration

        public Configuration​(@Nullable Map<String,​Object> properties)
        Create a new configuration.
        Parameters:
        properties - the properties the configuration should be filled. If null, an empty configuration is created.
    • Method Detail

      • as

        public <T> T as​(Class<T> configurationClass)
      • containsKey

        public boolean containsKey​(String key)
        Check if the given key is present in the configuration.
        Parameters:
        key - the key that existence should be checked
        Returns:
        true if the key is part of the configuration, false if not
      • setProperties

        public void setProperties​(Map<String,​Object> newProperties)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(@Nullable Object obj)
        Overrides:
        equals in class Object