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:
@@ -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>
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user