Class ConfigurationHelper<C>

java.lang.Object
space.arim.dazzleconf.helper.ConfigurationHelper<C>
Type Parameters:
C - the type of the configuration

public class ConfigurationHelper<C> extends Object
Simple helper class designed to assist in reloading a configuration
Author:
A248
  • Constructor Details

    • ConfigurationHelper

      public ConfigurationHelper(Path configFolder, String fileName, ConfigurationFactory<C> factory)
      Creates from an enclosing directory, filename within that directory, and ConfigurationFactory.

      The configuration path will be located at configFolder.resolve(fileName)
      Parameters:
      configFolder - the enclosing directory
      fileName - the filename within the directory
      factory - the configuration factory
  • Method Details

    • getFactory

      public ConfigurationFactory<C> getFactory()
      Gets the configuration factory
      Returns:
      the configuration factory
    • reloadConfigData

      public C reloadConfigData() throws IOException, InvalidConfigException
      Loads/reloads the configuration data. If necessary, updates the config on the filesystem with the latest keys
      Returns:
      the loaded config data
      Throws:
      IOException - if an I/O exception occurred
      InvalidConfigException - if the loaded configuration was not valid (user error)