From 006dd919dfe27deec096930ac9858a92958b268f Mon Sep 17 00:00:00 2001 From: Guillaume Raffin Date: Sun, 12 May 2024 18:42:59 +0200 Subject: [PATCH] core: More comments --- .../electronwill/nightconfig/core/serde/Util.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/electronwill/nightconfig/core/serde/Util.java b/core/src/main/java/com/electronwill/nightconfig/core/serde/Util.java index 6c855e8e..97c38d3a 100644 --- a/core/src/main/java/com/electronwill/nightconfig/core/serde/Util.java +++ b/core/src/main/java/com/electronwill/nightconfig/core/serde/Util.java @@ -8,6 +8,14 @@ import com.electronwill.nightconfig.core.UnmodifiableConfig; final class Util { + /** + * Checks whether a value is empty, for a "sensible" definition of being empty. + *

+ * Note: this method may throw an exception if the value is null. + * + * @param configValue the value to test + * @return true if the value is empty + */ static boolean isEmpty(Object configValue) { if (configValue instanceof Collection) { return ((Collection) configValue).isEmpty(); @@ -111,9 +119,8 @@ boolean isEmpty(Object instance) { /** * A better version of {@link Class#isAssignableFrom(Class)} that works with - * null, - * widening primitive conversions and conversions between primitive types and - * wrapper types. + * null, widening primitive conversions and conversions between primitive types + * and wrapper types. * * @param fieldType the type of the field * @param valueType the type of the value