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>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
+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>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -55,7 +55,7 @@ public class MongoSource extends ConfigureSource<SourcedSection, Map<String, Obj
@Override
public void save() throws Exception {
Map<String, Object> data = this.rootSection.rawMap();
Map<String, Object> data = this.rootSection.asMap();
if (data.isEmpty()) return; // Skip saving if empty
if (data.containsKey("_id") && data.size() == 1) return; // Skip saving if only contains _id
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<artifactId>easyconfiguration-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>4.0.8</version>
<version>4.0.9</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<properties>
@@ -109,12 +109,12 @@ public class SQLSource extends ConfigureSource<SourcedSection, Map<String, Objec
@Nullable Object value = section.get(path);
if (value instanceof SourcedSection) {
value = ((SourcedSection) value).rawMap();
value = ((SourcedSection) value).asMap();
} else if (value instanceof List<?>) {
List<Object> list = new ArrayList<>();
for (Object obj : (List<?>) value) {
if (obj instanceof SourcedSection) {
list.add(((SourcedSection) obj).rawMap());
list.add(((SourcedSection) obj).asMap());
} else {
list.add(obj);
}
+1 -1
View File
@@ -6,7 +6,7 @@
<parent>
<artifactId>easyconfiguration-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>4.0.8</version>
<version>4.0.9</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<properties>