Package rocks.rdil.simpleconfig
Class ConfigurationSystem
- java.lang.Object
-
- rocks.rdil.simpleconfig.ConfigurationSystem
-
public class ConfigurationSystem extends java.lang.Object
The system's main class used for management. Every JSON file should have an instance of this, and JSON files can have unlimited options/option classes.
-
-
Constructor Summary
Constructors Constructor Description ConfigurationSystem(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
getJsonObject()
Get the JSON object for this instance of the system's file.void
register(java.lang.Object config)
Registers a class and all theOption
s it contains to the current JSON file.void
save()
Saves the configuration to the file assigned to this handler.void
unregister(java.lang.Object config)
Removes a class and any option it contains from this handler.
-
-
-
Method Detail
-
getJsonObject
public com.google.gson.JsonObject getJsonObject()
Get the JSON object for this instance of the system's file.- Returns:
- The JsonObject instance.
-
register
public void register(java.lang.Object config)
Registers a class and all theOption
s it contains to the current JSON file.- Parameters:
config
- The class to be registered.
-
unregister
public void unregister(java.lang.Object config)
Removes a class and any option it contains from this handler. This may cause changes to be discarded!- Parameters:
config
- The class to unregister.
-
save
public void save()
Saves the configuration to the file assigned to this handler.
-
-