Class Json5GenericConfiguration<T extends AbstractJsonConfiguration>

java.lang.Object
com.dianxin.tori.base.configuration.json.Json5GenericConfiguration<T>
Type Parameters:
T - The concrete configuration type, which must extend AbstractJsonConfiguration

public class Json5GenericConfiguration<T extends AbstractJsonConfiguration> extends Object
A generic configuration manager that supports reading, saving, and hot-reloading JSON5 configuration files at runtime.
  • Constructor Details

    • Json5GenericConfiguration

      public Json5GenericConfiguration(String defaultResource, String filePath, Class<T> clazz) throws IOException
      Initializes the JSON5 configuration manager. If the target configuration file does not exist, it will be copied from the specified default resource.
      Parameters:
      defaultResource - The fallback resource path inside the JAR (e.g., "config.json5")
      filePath - The target file path on the server filesystem
      clazz - The Class<T> token of the concrete configuration
      Throws:
      IOException - If an I/O error occurs during reading or writing
  • Method Details

    • reloadConfig

      public void reloadConfig()
      Reloads the configuration instance directly from the JSON5 file.
    • saveConfig

      public void saveConfig()
      Saves the current configuration instance state back to the JSON5 file.
    • getConfigFile

      public File getConfigFile()
    • getBotConfig

      public T getBotConfig()