mirror of
https://github.com/CarmJos/EasyConfiguration.git
synced 2026-06-04 10:38:19 +08:00
feat: Implement more sections functions
This commit is contained in:
@@ -30,6 +30,15 @@ public interface ConfigureSection {
|
||||
@Contract(pure = true)
|
||||
@Nullable ConfigureSection parent();
|
||||
|
||||
/**
|
||||
* Get the path separator for the section.
|
||||
*
|
||||
* @return The path separator
|
||||
*/
|
||||
default char pathSeparator() {
|
||||
return '.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if this section is a root section.
|
||||
*
|
||||
@@ -706,6 +715,11 @@ public interface ConfigureSection {
|
||||
return stream(path).map(parser);
|
||||
}
|
||||
|
||||
default String childPath(String path) {
|
||||
int index = path.indexOf(pathSeparator());
|
||||
return (index == -1) ? path : path.substring(index + 1);
|
||||
}
|
||||
|
||||
static <T, C extends Collection<T>> @NotNull C parseCollection(
|
||||
@Nullable List<?> data,
|
||||
@NotNull Supplier<C> constructor,
|
||||
|
||||
Reference in New Issue
Block a user