- Type Parameters:
T
- the type of data propagated with the event.
- All Known Subinterfaces:
ComponentValue<T,
,C> Event<T>
,PropertyValue<T>
,State
,State.Combination
,StateObserver
,Value<T>
,ValueObserver<T>
,ValueSet<T>
,ValueSetObserver<T>
- All Known Implementing Classes:
AbstractComponentValue
,AbstractTextComponentValue
,AbstractValue
public interface EventObserver<T>
Manages listeners for an Event.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addDataListener
(Consumer<? super T> listener) Addslistener
to thisEventObserver
.boolean
addListener
(Runnable listener) Addslistener
to thisEventObserver
.boolean
addWeakDataListener
(Consumer<? super T> listener) Uses aWeakReference
, addinglistener
does not prevent it from being garbage collected.boolean
addWeakListener
(Runnable listener) Uses aWeakReference
, addinglistener
does not prevent it from being garbage collected.boolean
removeDataListener
(Consumer<? super T> listener) Removeslistener
from thisEventObserver
boolean
removeListener
(Runnable listener) Removeslistener
from thisEventObserver
boolean
removeWeakDataListener
(Consumer<? super T> listener) Removeslistener
from thisEventObserver
.boolean
removeWeakListener
(Runnable listener) Removeslistener
from thisEventObserver
-
Method Details
-
addListener
Addslistener
to thisEventObserver
. Adding the same listener a second time has no effect.- Parameters:
listener
- the listener to add- Returns:
- true if this observer did not already contain the specified listener
- Throws:
NullPointerException
- in case listener is null
-
removeListener
Removeslistener
from thisEventObserver
- Parameters:
listener
- the listener to remove- Returns:
- true if this observer contained the specified listener
-
addDataListener
Addslistener
to thisEventObserver
. Adding the same listener a second time has no effect.- Parameters:
listener
- the listener to add- Returns:
- true if this observer did not already contain the specified listener
- Throws:
NullPointerException
- in case listener is null
-
removeDataListener
Removeslistener
from thisEventObserver
- Parameters:
listener
- the listener to remove- Returns:
- true if this observer contained the specified listener
-
addWeakListener
Uses aWeakReference
, addinglistener
does not prevent it from being garbage collected. Adding the same listener a second time has no effect.- Parameters:
listener
- the listener- Returns:
- true if this observer did not already contain the specified listener
-
removeWeakListener
Removeslistener
from thisEventObserver
- Parameters:
listener
- the listener to remove- Returns:
- true if this observer contained the specified listener
-
addWeakDataListener
Uses aWeakReference
, addinglistener
does not prevent it from being garbage collected. Adding the same listener a second time has no effect.- Parameters:
listener
- the listener- Returns:
- true if this observer did not already contain the specified listener
-
removeWeakDataListener
Removeslistener
from thisEventObserver
.- Parameters:
listener
- the listener to remove- Returns:
- true if this observer contained the specified listener
-