Class ConfigurationWrapper<T extends Configuration>
- Direct Known Subclasses:
YamlFileWrapper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceprotected static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Tprotected final ConfigurationWrapper<T>protected final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionConfigurationWrapper(T configuration, String path) protectedConfigurationWrapper(T configuration, String path, ConfigurationWrapper<T> parent) -
Method Summary
Modifier and TypeMethodDescriptionaddDefault(Object value) Sets the default value of this path.addDefault(String child, Object value) Sets the default value of the provided child path.protected ConfigurationWrapper<T>protected ConfigurationWrapper<T>applyToChild(ConfigurationWrapper.ApplyToPath method, String path) protected final StringCreates an emptyConfigurationSectionat this path.createSection(String child) Creates an emptyConfigurationSectionat the provided child path.booleanGets the current path.inthashCode()parent()Returns to the parent.Get a wrapper builder for the given child path.Set the given value to this path.protected ConfigurationWrapper<T>set(ConfigurationWrapper.SetToPath method, Object value) Set the given value to the provided child path.protected ConfigurationWrapper<T>setToChild(ConfigurationWrapper.SetToPath method, String child, Object value)
-
Field Details
-
configuration
-
path
-
parent
-
-
Constructor Details
-
ConfigurationWrapper
-
ConfigurationWrapper
-
-
Method Details
-
path
Get a wrapper builder for the given child path.- Parameters:
path- child path of this section path, not null.- Returns:
- the child path wrapper
- Throws:
IllegalArgumentException- if path is null
-
set
Set the given value to this path.If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.
- Parameters:
value- new value to set the path to.- Returns:
- this object, for chaining.
-
setChild
Set the given value to the provided child path.If value is null, the entry will be removed. Any existing entry will be replaced, regardless of what the new value is.
- Parameters:
child- the child path of this section path.value- new value to set the child path to.- Returns:
- this object, for chaining.
-
addDefault
Sets the default value of this path.If no source
Configurationwas provided as a default collection, then a newMemoryConfigurationwill 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.- Parameters:
value- value to set the default to.- Returns:
- this object, for chaining.
-
addDefault
Sets the default value of the provided child path.If no source
Configurationwas provided as a default collection, then a newMemoryConfigurationwill 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.- Parameters:
child- the child path of this section path.value- value to set the default to.- Returns:
- this object, for chaining.
-
createSection
Creates an emptyConfigurationSectionat 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.- Returns:
- this object, for chaining.
-
createSection
Creates an emptyConfigurationSectionat 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.- Parameters:
child- the child path of this section path.- Returns:
- this object, for chaining.
-
getCurrentPath
Gets the current path.- Returns:
- this path.
-
parent
Returns to the parent.- Returns:
- the parent path wrapper, or null if this path does not have a parent.
-
childPath
-
apply
-
applyToChild
protected ConfigurationWrapper<T> applyToChild(ConfigurationWrapper.ApplyToPath method, String path) -
set
-
setToChild
protected ConfigurationWrapper<T> setToChild(ConfigurationWrapper.SetToPath method, String child, Object value) -
equals
-
hashCode
public int hashCode()
-