public class ConfigurationWrapper<T extends Configuration> extends Object
Modifier and Type | Class and Description |
---|---|
protected static interface |
ConfigurationWrapper.ApplyToPath |
protected static interface |
ConfigurationWrapper.SetToPath |
Modifier and Type | Field and Description |
---|---|
protected T |
configuration |
protected ConfigurationWrapper<T> |
parent |
protected String |
path |
Modifier | Constructor and Description |
---|---|
|
ConfigurationWrapper(T configuration,
String path) |
protected |
ConfigurationWrapper(T configuration,
String path,
ConfigurationWrapper<T> parent) |
protected final T extends Configuration configuration
protected final String path
protected final ConfigurationWrapper<T extends Configuration> parent
protected ConfigurationWrapper(T configuration, String path, ConfigurationWrapper<T> parent)
public ConfigurationWrapper<T> path(String path)
path
- child path of this section path, not null.IllegalArgumentException
- if path is nullpublic ConfigurationWrapper<T> set(Object value)
If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.
value
- new value to set the path to.public ConfigurationWrapper<T> setChild(String child, Object value)
If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.
child
- the child path of this section path.value
- new value to set the child path to.public ConfigurationWrapper<T> addDefault(Object value)
If no source Configuration
was provided as a default
collection, then a new MemoryConfiguration
will be created to
hold the new default value.
If value is null, the value will be removed from the default Configuration source.
If the value as returned by ConfigurationSection.getDefaultSection()
is null, then
this will create a new section at the path, replacing anything that may
have existed there previously.
value
- value to set the default to.public ConfigurationWrapper<T> addDefault(String child, Object value)
If no source Configuration
was provided as a default
collection, then a new MemoryConfiguration
will be created to
hold the new default value.
If value is null, the value will be removed from the default Configuration source.
If the value as returned by ConfigurationSection.getDefaultSection()
is null, then
this will create a new section at the path, replacing anything that may
have existed there previously.
child
- the child path of this section path.value
- value to set the default to.public ConfigurationWrapper<T> createSection()
ConfigurationSection
at this path.
Any value that was previously set at this path will be overwritten. If
the previous value was itself a ConfigurationSection
, it will
be orphaned.
public ConfigurationWrapper<T> createSection(String child)
ConfigurationSection
at the provided child path.
Any value that was previously set at this will be overwritten. If
the previous value was itself a ConfigurationSection
, it will
be orphaned.
child
- the child path of this section path.public String getCurrentPath()
public ConfigurationWrapper<T> parent()
protected ConfigurationWrapper<T> apply(ConfigurationWrapper.ApplyToPath method)
protected ConfigurationWrapper<T> applyToChild(ConfigurationWrapper.ApplyToPath method, String path)
protected ConfigurationWrapper<T> set(ConfigurationWrapper.SetToPath method, Object value)
protected ConfigurationWrapper<T> setToChild(ConfigurationWrapper.SetToPath method, String child, Object value)
Copyright © 2023. All rights reserved.