Class StandardConfigHandler

All Implemented Interfaces:
IConfigHandler

public class StandardConfigHandler
extends IPublisher
implements IConfigHandler

Standard config handler

Standard (default) implementation of the IConfigHandler component.
  • Constructor Details

    • StandardConfigHandler

      public StandardConfigHandler​(ApplicationFramework applicationFramework)
  • Method Details

    • loadConfig

      public boolean loadConfig​(String name)
      Description copied from interface: IConfigHandler
      Loads the configuration file from the given URI. Returns true if successful, false otherwise.
      Specified by:
      loadConfig in interface IConfigHandler
      Parameters:
      name - Config name.
      Returns:
      True if loaded, false otherwise.
    • resetConfig

      public void resetConfig()
      Description copied from interface: IConfigHandler
      Loads the default config.
      Specified by:
      resetConfig in interface IConfigHandler
    • saveConfig

      public void saveConfig()
      Description copied from interface: IConfigHandler
      Saves the current configuration.
      Specified by:
      saveConfig in interface IConfigHandler
    • set

      public void set​(String key, String val)
      Description copied from interface: IConfigHandler
      Sets the configuration value for the given key.
      Specified by:
      set in interface IConfigHandler
      Parameters:
      key - Config key.
      val - Value to set.
    • get

      public Object get​(String key)
      Description copied from interface: IConfigHandler
      Returns the configuration value for the given key.
      Specified by:
      get in interface IConfigHandler
      Parameters:
      key - Config key.
      Returns:
      Value if set, otherwise null.
    • get

      public Object get​(String key, Object defaultValue)
      Description copied from interface: IConfigHandler
      Returns the configuration value for the given key, or default value if key not set.
      Specified by:
      get in interface IConfigHandler
      Parameters:
      key - Config key.
      defaultValue - Default value to return if config key not set.
      Returns:
      Value if set, otherwise defaultValue.
    • createConfig

      public void createConfig​(String name)
      Description copied from interface: IConfigHandler
      Sets up a new configuration in program and in memory.
      Specified by:
      createConfig in interface IConfigHandler
      Parameters:
      name - New configuration name.