aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuuz <6596629+Juuxel@users.noreply.github.com>2021-09-10 15:45:39 +0300
committerJuuz <6596629+Juuxel@users.noreply.github.com>2021-09-10 15:45:39 +0300
commit7da9984fc611a07e948d0d80d61471d12646488c (patch)
tree26e7dc1d01c828a65765dac38b2500b6cb8f3cdc /src
parentcb16236da50cfe864268af2db46c6ef11ab2e224 (diff)
downloadLibGui-7da9984fc611a07e948d0d80d61471d12646488c.tar.gz
LibGui-7da9984fc611a07e948d0d80d61471d12646488c.tar.bz2
LibGui-7da9984fc611a07e948d0d80d61471d12646488c.zip
Document ObservableProperty.add/removeListener
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java
index 3b0205e..7111b25 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java
@@ -130,11 +130,23 @@ public final class ObservableProperty<T> implements Supplier<T> {
return this;
}
+ /**
+ * Adds a change listener to this observable property.
+ *
+ * @param listener the added listener
+ */
public void addListener(ChangeListener<? super T> listener) {
+ Objects.requireNonNull(listener);
listeners.add(listener);
}
+ /**
+ * Removes a change listener from this observable property if present.
+ *
+ * @param listener the removed listener
+ */
public void removeListener(ChangeListener<? super T> listener) {
+ Objects.requireNonNull(listener);
listeners.remove(listener);
}