mirror of
https://github.com/CarmJos/EasyConfiguration.git
synced 2026-06-04 18:48:20 +08:00
feat(section): Add original method
This commit is contained in:
+14
@@ -2,6 +2,7 @@ package cc.carm.lib.configuration.source.section;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.UnmodifiableView;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -48,6 +49,19 @@ public abstract class MapSection<R extends MapSection<R>> implements ConfigureSe
|
||||
return this.data;
|
||||
}
|
||||
|
||||
@UnmodifiableView
|
||||
public @NotNull Map<String, Object> original() {
|
||||
Map<String, Object> output = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, Object> entry : this.data.entrySet()) {
|
||||
if (entry.getValue() instanceof MapSection<?>) {
|
||||
output.put(entry.getKey(), ((MapSection<?>) entry.getValue()).original());
|
||||
} else {
|
||||
output.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public @Nullable R parent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user