1
mirror of https://github.com/CarmJos/EasyConfiguration.git synced 2024-09-19 20:25:51 +00:00

feat(parse): 新增两种忽略默认值的parseValue方法。

This commit is contained in:
Carm Jos 2023-08-07 22:06:03 +08:00
parent 07424284b7
commit b668794f5d
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,10 @@ public class SectionValueBuilder<V>
return this;
}
public @NotNull SectionValueBuilder<V> parseValue(ConfigDataFunction<ConfigurationWrapper<?>, V> valueParser) {
return parseValue((section, path) -> valueParser.parse(section));
}
public @NotNull SectionValueBuilder<V> parseValue(ConfigValueParser<ConfigurationWrapper<?>, V> valueParser) {
this.parser = valueParser;
return this;

View File

@ -39,6 +39,10 @@ public class SourceValueBuilder<S, V> extends CommonConfigBuilder<V, SourceValue
return this;
}
public @NotNull SourceValueBuilder<S, V> parseValue(ConfigDataFunction<S, V> valueParser) {
return parseValue((section, path) -> valueParser.parse(section));
}
public @NotNull SourceValueBuilder<S, V> parseValue(@NotNull ConfigValueParser<S, V> valueParser) {
this.valueParser = valueParser;
return this;