1
mirror of https://github.com/CarmJos/EasyConfiguration.git synced 2026-06-04 10:38:19 +08:00

feat(section): Add ConfigureSection#asMap function

This commit is contained in:
2025-03-04 01:06:21 +08:00
parent 251dd208af
commit c2a9e2254c
19 changed files with 119 additions and 91 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
<parent>
<artifactId>easyconfiguration-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>4.0.8</version>
<version>4.0.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<properties>
@@ -48,7 +48,6 @@ public interface ConfigureSection {
return (parent().isRoot() ? "" : parent().fullPath() + pathSeparator()) + path();
}
/**
* Get the path separator for the section.
*
@@ -143,6 +142,17 @@ public interface ConfigureSection {
return getValues(false);
}
/**
* Get this section as a map.
* <p>
* In this map, child {@link ConfigureSection}s will also be represented as {@link Map}s.
*
* @return Map of data values contained within this Section.
*/
@NotNull
@UnmodifiableView
Map<String, Object> asMap();
/**
* Create a stream of all values in this section.
*
@@ -153,7 +163,7 @@ public interface ConfigureSection {
}
/**
* Iterates over all keys in this section.
* Iterates over all key-values in this section (include child sections)
*
* @param action The action to apply to each key.
*/
@@ -107,6 +107,11 @@ public abstract class ConfigureSource<
return section().getKeys(deep);
}
@Override
public @NotNull @UnmodifiableView Map<String, Object> asMap() {
return section().asMap();
}
@Override
public @NotNull ConfigureSection createSection(@NotNull String path, @NotNull Map<?, ?> data) {
return section().createSection(path, data);