Package com.assemblyrobot.shared.config
Class Config
java.lang.Object
com.assemblyrobot.shared.config.Config
public abstract class Config
extends java.lang.Object
Central configuration loader and manager class.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Config.UserSetting
-
Constructor Summary
Constructors Constructor Description Config()
-
Method Summary
Modifier and Type Method Description static Configuration
getConfig()
Returns the configuration as defined in resources/config/config.json, or in an optional custom path if specified by the user.static java.lang.String
getUserSetting(Config.UserSetting setting)
Gets a user setting as a string, or null if not defined.static boolean
getUserSettingBoolean(Config.UserSetting setting)
Gets a user setting as a boolean.static boolean
hasUserSetting(Config.UserSetting setting)
Checks if a user setting exists.static void
load()
(Re)loads the configuration file from either the default path (DEFAULT_CONFIG_PATH
) or a custom path as specified by the user.static void
putUserSetting(Config.UserSetting setting, boolean value)
Defines a user setting as a boolean value.static void
putUserSetting(Config.UserSetting setting, java.lang.String value)
Defines a user setting as a string value.static void
removeUserSetting(Config.UserSetting setting)
Removes a user setting.static void
updateConfig(Configuration newConfig)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Config
public Config()
-
-
Method Details
-
getConfig
Returns the configuration as defined in resources/config/config.json, or in an optional custom path if specified by the user.- Returns:
Configuration
-
load
public static void load()(Re)loads the configuration file from either the default path (DEFAULT_CONFIG_PATH
) or a custom path as specified by the user.An exception in the loading process of a custom config will cause an all-or-nothing fallback to the default configuration.
-