Class RenderModuleConfig

java.lang.Object
io.codetoil.curved_spacetime.render.RenderModuleConfig
All Implemented Interfaces:
ModuleConfig

public class RenderModuleConfig extends Object implements ModuleConfig
The render module's settings, read from config/render-module.config.

The render module is an API with no settings of its own yet, so the file is currently written empty. It exists so that the file and its handling are already in place when the first key is added, and so that implementations have a configuration to inherit the pattern from.

  • Constructor Details

    • RenderModuleConfig

      public RenderModuleConfig(Logger logger)
      Creates a configuration that reports load problems to the given logger.
      Parameters:
      logger - the logger to warn through when the file is missing
  • Method Details

    • load

      public RenderModuleConfig load() throws IOException
      Reads the configuration from disk, tolerating an absent file.
      Specified by:
      load in interface ModuleConfig
      Returns:
      this configuration, so that construction and loading compose
      Throws:
      IOException - if the file exists but cannot be read
    • save

      public void save() throws IOException
      Writes the configuration to disk and clears the dirty flag.
      Specified by:
      save in interface ModuleConfig
      Throws:
      IOException - if the file cannot be written
    • isDirty

      public boolean isDirty()
      Returns whether this configuration differs from what is on disk.

      With no keys yet, the only cause is the file having been absent when it was loaded; save() clears it.

      Specified by:
      isDirty in interface ModuleConfig
      Returns:
      true if the file does not match this configuration and should be rewritten