Class TomlConfiguration

java.lang.Object
space.b00tload.utils.configuration.TomlConfiguration
All Implemented Interfaces:
AutoCloseable

public class TomlConfiguration extends Object implements AutoCloseable
Interfaces with the toml config file.
  • Method Details

    • close

      public void close()
      Saves and closes the config file.
      Specified by:
      close in interface AutoCloseable
    • checkVersion

      public void checkVersion(String currentVersion)
      Checks whether the config version is the same as software version. Sends a warning to stderr if version was updated.
      Parameters:
      currentVersion - The current software version.
    • contains

      public boolean contains(String key)
      Checks if the config contains a value at some path.
      Parameters:
      key - the path to check, each part separated by a dot. Example "a. b. c"
      Returns:
      true if the path is associated with a value, false if it's not.
    • getString

      public String getString(String key)
      Gets a value from the config.
      Parameters:
      key - the value's path, each part separated by a dot. Example "a. b. c"
      Returns:
      the value at the given path, or null if there is no such value.
    • setString

      public void setString(String key, String value)
      Sets a value to the config.
      Parameters:
      key - the value's path, each part separated by a dot. Example "a. b. c"
      value - the value to set