mirror of
https://github.com/CarmJos/EasyConfiguration.git
synced 2026-06-04 10:38:19 +08:00
feat: Simplify the ConfigureSection functions to support more different usages.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<artifactId>easyconfiguration-parent</artifactId>
|
||||
<groupId>cc.carm.lib</groupId>
|
||||
<version>4.0.1</version>
|
||||
<version>4.0.2</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<properties>
|
||||
|
||||
@@ -4,7 +4,6 @@ import cc.carm.lib.configuration.commentable.Commentable;
|
||||
import cc.carm.lib.configuration.commentable.CommentableOptions;
|
||||
import cc.carm.lib.configuration.source.ConfigurationHolder;
|
||||
import cc.carm.lib.configuration.source.file.FileConfigSource;
|
||||
import cc.carm.lib.configuration.source.option.StandardOptions;
|
||||
import cc.carm.lib.configuration.source.section.ConfigureSection;
|
||||
import cc.carm.lib.configuration.source.section.MemorySection;
|
||||
import cc.carm.lib.yamlcommentupdater.CommentedSection;
|
||||
@@ -56,7 +55,7 @@ public class YAMLSource
|
||||
}
|
||||
|
||||
@Override
|
||||
protected YAMLSource self() {
|
||||
protected @NotNull YAMLSource self() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -70,11 +69,6 @@ public class YAMLSource
|
||||
return Objects.requireNonNull(this.rootSection, "Root section is not initialized.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public char separator() {
|
||||
return holder().options().get(StandardOptions.PATH_SEPARATOR);
|
||||
}
|
||||
|
||||
public @NotNull LoaderOptions loaderOptions() {
|
||||
return holder().options().get(YAMLOptions.LOADER);
|
||||
}
|
||||
@@ -115,7 +109,7 @@ public class YAMLSource
|
||||
@Override
|
||||
public void save() throws Exception {
|
||||
CommentedYAMLWriter writer = new CommentedYAMLWriter(
|
||||
String.valueOf(this.separator()),
|
||||
String.valueOf(this.pathSeparator()),
|
||||
dumperOptions().getIndent(),
|
||||
holder.options().get(CommentableOptions.COMMENT_EMPTY_VALUE)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user