aboutsummaryrefslogtreecommitdiff
path: root/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java
diff options
context:
space:
mode:
authorisXander <xander@isxander.dev>2023-08-18 11:43:52 +0100
committerisXander <xander@isxander.dev>2023-08-18 11:43:52 +0100
commitd7a9d31706a30c8b66dcd0587f6c82cf7c6118c9 (patch)
tree3464ddc568505ecd3095523bb7c8d2e70de00127 /common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java
parent39bc5b5d8b8e6d4369ea71a7787907521e11ad34 (diff)
downloadYetAnotherConfigLib-d7a9d31706a30c8b66dcd0587f6c82cf7c6118c9.tar.gz
YetAnotherConfigLib-d7a9d31706a30c8b66dcd0587f6c82cf7c6118c9.tar.bz2
YetAnotherConfigLib-d7a9d31706a30c8b66dcd0587f6c82cf7c6118c9.zip
Enforce NotNull on bindings
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java')
-rw-r--r--common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java b/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java
index 165f38d..37a626b 100644
--- a/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java
+++ b/common/src/main/java/dev/isxander/yacl3/impl/OptionImpl.java
@@ -41,7 +41,7 @@ public final class OptionImpl<T> implements Option<T> {
@NotNull Collection<BiConsumer<Option<T>, T>> listeners
) {
this.name = name;
- this.binding = binding;
+ this.binding = new SafeBinding<>(binding);
this.available = available;
this.flags = flags;
this.listeners = new ArrayList<>(listeners);
@@ -108,7 +108,9 @@ public final class OptionImpl<T> implements Option<T> {
}
@Override
- public void requestSet(T value) {
+ public void requestSet(@NotNull T value) {
+ Validate.notNull(value, "`value` cannot be null");
+
pendingValue = value;
this.triggerListeners(true);
}