mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-03-11 14:09:56 +01:00
Adds SongodaYamlConfig#getAsEntry(String) for convenience
If you are reading a config dynamically instead of fully creating it with all the entries beforehand, this method can be used to easily access the *converted/casted* values.
This commit is contained in:
parent
78b6039d39
commit
20b7a353b8
@ -25,6 +25,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
// TODO: Allow registering load-Listeners
|
||||
// TODO: Provide method to only save if changed
|
||||
public class SongodaYamlConfig extends YamlConfiguration {
|
||||
protected final String cannotCreateBackupCopyExceptionPrefix = "Unable to create backup copy of config file: ";
|
||||
|
||||
@ -81,6 +82,10 @@ public class SongodaYamlConfig extends YamlConfiguration {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ConfigEntry getAsEntry(String key) {
|
||||
return new ConfigEntry(this, key);
|
||||
}
|
||||
|
||||
protected void registerConfigEntry(ConfigEntry entry) {
|
||||
this.configEntries.put(entry.key, entry);
|
||||
}
|
||||
@ -138,7 +143,7 @@ public class SongodaYamlConfig extends YamlConfiguration {
|
||||
public void load(Reader reader) {
|
||||
super.load(reader);
|
||||
|
||||
// The interface does not allow to throw an exception, so we log it instead.
|
||||
// FIXME: The interface does not allow to throw an exception, so we log it instead.
|
||||
try {
|
||||
upgradeOldConfigVersion();
|
||||
} catch (IOException ex) {
|
||||
|
Loading…
Reference in New Issue
Block a user