1
mirror of https://github.com/CarmJos/EasyConfiguration.git synced 2026-06-04 10:38:19 +08:00

feat(section): Add #contains and #containsValue methods

This commit is contained in:
2025-02-21 17:15:16 +08:00
parent 3473ef2247
commit df19da170b
2 changed files with 25 additions and 1 deletions
@@ -155,7 +155,7 @@ public interface ConfigureSection {
void remove(@NotNull String path);
/**
* Check if the value of given path is present.
* Check if the given path is present.
* <p>
* Path separator depends on holder's
* {@link cc.carm.lib.configuration.source.option.StandardOptions#PATH_SEPARATOR}
@@ -164,6 +164,19 @@ public interface ConfigureSection {
* @return True if the value is present, false otherwise.
*/
default boolean contains(@NotNull String path) {
return getKeys(true).contains(path);
}
/**
* Check if the value of given path is present.
* <p>
* Path separator depends on holder's
* {@link cc.carm.lib.configuration.source.option.StandardOptions#PATH_SEPARATOR}
*
* @param path The path to check.
* @return True if the value is present, false otherwise.
*/
default boolean containsValue(@NotNull String path) {
return get(path) != null;
}