Package com.ultikits.ultitools.utils
Class ConfigEditorUtils
java.lang.Object
com.ultikits.ultitools.utils.ConfigEditorUtils
Utility class for configuration editor operations.
Provides methods to get and update configuration data in JSON format.
This class is used internally by the configuration editor system.
- Since:
- 6.0.0
- Author:
- wisdomme
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringGet the comment map as a JSON string.protected static StringGet the configuration map as a JSON string.protected static voidupdateConfigMap(String configMapString) Update the configuration map from a JSON string.protected static voidupdateConfigMap(String fileName, String configMapString) Update a single configuration file from a JSON string.
-
Constructor Details
-
ConfigEditorUtils
public ConfigEditorUtils()
-
-
Method Details
-
getConfigMapString
Get the configuration map as a JSON string.- Returns:
- JSON string representation of the configuration map
-
getCommentMapString
Get the comment map as a JSON string.- Returns:
- JSON string representation of the comment map
-
updateConfigMap
Update the configuration map from a JSON string.- Parameters:
configMapString- JSON string containing the new configuration- Throws:
IOException- if an I/O error occurs during update
-
updateConfigMap
Update a single configuration file from a JSON string.This is the path taken when the panel pushes configuration by file name:
configMapStringis that file's own{configEntry: value}, not the full{pluginName: {configPath: {...}}}structure thatupdateConfigMap(String)expects. The two shapes correspond to two distinct entry points on the panel; mixing them silently fails to write and reports no error -- see issue #236.- Parameters:
fileName- config file path as registered, e.g.config/lang.ymlconfigMapString- JSON string containing that file's entries- Throws:
IOException- if the file is unknown or ambiguous, or the update fails- Since:
- 6.2.5
-