Class ConfigHandler


  • public final class ConfigHandler
    extends java.lang.Object
    The handler for JSON files - manages Config classes.
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigHandler​(java.io.File file)
      Creates a new instance of the configuration handler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.gson.JsonObject getCfg()
      Get the JSON object for all the registered Configs.
      void register​(Config config)
      Registers a Config class to the current JSON file.
      void save()
      Saves the configuration to the file assigned to this handler.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfigHandler

        public ConfigHandler​(java.io.File file)
        Creates a new instance of the configuration handler.
        Parameters:
        file - The file that the configuration should be saved/loaded from.
    • Method Detail

      • getCfg

        public final com.google.gson.JsonObject getCfg()
        Get the JSON object for all the registered Configs.
        Returns:
        The JsonObject instance.
      • register

        public final void register​(Config config)
        Registers a Config class to the current JSON file.
        Parameters:
        config - The config class.
      • save

        public final void save()
        Saves the configuration to the file assigned to this handler.