Class DefaultConfigurationRepository

    • Constructor Detail

      • DefaultConfigurationRepository

        public DefaultConfigurationRepository​(KeyValueTable table)
        Creates a new DefaultConfigurationRepository, using the provided table for data storage.
        Parameters:
        table - key-value table used for data storage
    • Method Detail

      • fetch

        public <T> Optional<T> fetch​(String key,
                                     Class<T> clazz)
        Description copied from interface: ConfigurationRepository
        Retrieves configuration properties from the record stored under the provided key, and maps them to the provided class.
        Specified by:
        fetch in interface ConfigurationRepository
        Type Parameters:
        T - type of the provided class
        Parameters:
        key - key of the configuration record
        clazz - a class to which the retrieved properties will be mapped
        Returns:
        an object of a given class, created by mapping the retrieved configuration properties
      • update

        public <T> void update​(String key,
                               T value)
        Description copied from interface: ConfigurationRepository
        Updates the configuration properties in the record stored under the provided key. If the configuration is not present, a new record will be created.
        Specified by:
        update in interface ConfigurationRepository
        Type Parameters:
        T - type of the provided value
        Parameters:
        key - key of the configuration record
        value - new configuration properties
      • delete

        public void delete​(String key)
        Description copied from interface: ConfigurationRepository
        Deletes the configuration record stored under the provided key. If the record does not exist, then no action is taken.
        Specified by:
        delete in interface ConfigurationRepository
        Parameters:
        key - key of the configuration record