Package io.github.mmm.value.observable
Class ObservableEventReceiver<V>
- java.lang.Object
-
- io.github.mmm.value.observable.ObservableEventReceiver<V>
-
- Type Parameters:
V
- type of the value.
- All Implemented Interfaces:
EventListener<ObservableEvent<V>>
,ObservableEventListener<V>
public class ObservableEventReceiver<V> extends Object implements ObservableEventListener<V>
Implementation ofObservableEventListener
thatcounts
thereceived
events and allows toget the last received event
. Mainly useful for testing.
-
-
Constructor Summary
Constructors Constructor Description ObservableEventReceiver()
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObservableEvent<V>
getEvent()
int
getEventCount()
void
onEvent(ObservableEvent<V> e)
This method is called if an event occurred.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.mmm.event.EventListener
isMatchedUsingEquals
-
-
-
-
Method Detail
-
onEvent
public void onEvent(ObservableEvent<V> e)
Description copied from interface:EventListener
This method is called if an event occurred.
WARNING:
Depending on the implementation ofEventSource
it may NOT be legal toadd
orremove
listeners during the call of this method as this may lead to a dead-lock.- Specified by:
onEvent
in interfaceEventListener<V>
- Parameters:
e
- is the event that notifies about something that happened.
-
getEvent
public ObservableEvent<V> getEvent()
- Returns:
- the last
ObservableEvent
that has beenreceived
. Will benull
if nothing received yet.
-
getEventCount
public int getEventCount()
- Returns:
- the number of
ObservableEvent
sreceived
.
-
-