Class DynamicConfigManager
- java.lang.Object
-
- rs.kreme.ksbot.api.scripts.config.DynamicConfigManager
-
public class DynamicConfigManager extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description DynamicConfigManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanload(java.lang.Object target)Load config into target.voidopenEditor()booleanreload(java.lang.Object target)Reload the config from file into the provided target object.voidsave(java.lang.Object target)Save only annotated fields to JSON.voidsetConfigFile(java.io.File file)
-
-
-
Method Detail
-
setConfigFile
public void setConfigFile(java.io.File file)
-
load
public boolean load(java.lang.Object target) throws java.io.IOException, java.lang.ReflectiveOperationExceptionLoad config into target. Only fields annotated with @ConfigKey are considered.- Parameters:
target- the object to populate- Returns:
- true on success
- Throws:
java.io.IOException- if file IO failsjava.lang.ReflectiveOperationException
-
reload
public boolean reload(java.lang.Object target)
Reload the config from file into the provided target object. Uses same filtering as load().- Parameters:
target- object to update- Returns:
- true on success
-
save
public void save(java.lang.Object target) throws java.io.IOException, java.lang.ReflectiveOperationExceptionSave only annotated fields to JSON.- Parameters:
target- object to save- Throws:
java.io.IOExceptionjava.lang.ReflectiveOperationException
-
openEditor
public void openEditor()
-
close
public void close()
-
-