Class ConfigurationYAML
java.lang.Object
de.Keyle.MyPet.api.util.configuration.ConfigurationYAML
One YAML file on disk, with load, save and clear operations over its parsed contents.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConfigurationYAML(File file) Opens the given file, loading it immediately.ConfigurationYAML(String path) Opens the file at the given path, loading it immediately. -
Method Summary
Modifier and TypeMethodDescriptionvoidDiscards the loaded contents, leaving an empty configuration.The parsed contents ofyamlFile.booleanRe-reads the file from disk, replacing the current contents.booleanWrites the current contents back to disk.
-
Field Details
-
yamlFile
The file this configuration reads from and writes to.
-
-
Constructor Details
-
ConfigurationYAML
Opens the file at the given path, loading it immediately.- Parameters:
path- path to the YAML file
-
ConfigurationYAML
Opens the given file, loading it immediately.- Parameters:
file- the YAML file
-
-
Method Details
-
saveConfig
public boolean saveConfig()Writes the current contents back to disk.- Returns:
trueif the write succeeded
-
loadConfig
public boolean loadConfig()Re-reads the file from disk, replacing the current contents.- Returns:
trueif the file was read successfully
-
clearConfig
public void clearConfig()Discards the loaded contents, leaving an empty configuration. -
getConfig
The parsed contents ofyamlFile.- Returns:
- the live configuration; edits are written out by
saveConfig()
-