From 7da9984fc611a07e948d0d80d61471d12646488c Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Fri, 10 Sep 2021 15:45:39 +0300 Subject: Document ObservableProperty.add/removeListener --- .../cottonmc/cotton/gui/widget/data/ObservableProperty.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java') 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 implements Supplier { return this; } + /** + * Adds a change listener to this observable property. + * + * @param listener the added listener + */ public void addListener(ChangeListener 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 listener) { + Objects.requireNonNull(listener); listeners.remove(listener); } -- cgit