diff --git a/core/src/main/java/cc/carm/lib/configuration/source/section/ConfigureSection.java b/core/src/main/java/cc/carm/lib/configuration/source/section/ConfigureSection.java
index 52ad20a..2bd49e9 100644
--- a/core/src/main/java/cc/carm/lib/configuration/source/section/ConfigureSection.java
+++ b/core/src/main/java/cc/carm/lib/configuration/source/section/ConfigureSection.java
@@ -18,7 +18,7 @@ import java.util.stream.Stream;
* @author Carm
* @since 4.0.0
*/
-public interface ConfigureSection extends Cloneable {
+public interface ConfigureSection {
/**
* Gets the parent section of this section.
@@ -30,6 +30,24 @@ public interface ConfigureSection extends Cloneable {
@Contract(pure = true)
@Nullable ConfigureSection parent();
+ /**
+ * Gets if this section is a root section.
+ *
+ * @return True if this section is a root section, false otherwise.
+ */
+ default boolean isRoot() {
+ return parent() == null;
+ }
+
+ /**
+ * Gets if this section is empty.
+ *
+ * @return True if this section is empty, false otherwise.
+ */
+ default boolean isEmpty() {
+ return getValues(false).isEmpty();
+ }
+
/**
* Gets a set containing all keys in this section.
*
@@ -190,7 +208,10 @@ public interface ConfigureSection extends Cloneable {
* @return The section if the path exists and is a section, otherwise null.
*/
@Nullable
- ConfigureSection getSection(@NotNull String path);
+ default ConfigureSection getSection(@NotNull String path) {
+ Object val = get(path);
+ return (val instanceof ConfigureSection) ? (ConfigureSection) val : null;
+ }
/**
* Get the origin value of the path.
@@ -686,7 +707,8 @@ public interface ConfigureSection extends Cloneable {
}
static > @NotNull C parseCollection(
- @Nullable List> data, @NotNull Supplier constructor,
+ @Nullable List> data,
+ @NotNull Supplier constructor,
@NotNull DataFunction