diff options
author | Juuz <6596629+Juuxel@users.noreply.github.com> | 2021-09-10 15:45:39 +0300 |
---|---|---|
committer | Juuz <6596629+Juuxel@users.noreply.github.com> | 2021-09-10 15:45:39 +0300 |
commit | 7da9984fc611a07e948d0d80d61471d12646488c (patch) | |
tree | 26e7dc1d01c828a65765dac38b2500b6cb8f3cdc | |
parent | cb16236da50cfe864268af2db46c6ef11ab2e224 (diff) | |
download | LibGui-7da9984fc611a07e948d0d80d61471d12646488c.tar.gz LibGui-7da9984fc611a07e948d0d80d61471d12646488c.tar.bz2 LibGui-7da9984fc611a07e948d0d80d61471d12646488c.zip |
Document ObservableProperty.add/removeListener
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/data/ObservableProperty.java | 12 |
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); } |