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 ofObservableEventListenerthatcountsthereceivedevents 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()intgetEventCount()voidonEvent(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:EventListenerThis method is called if an event occurred.
WARNING:
Depending on the implementation ofEventSourceit may NOT be legal toaddorremovelisteners during the call of this method as this may lead to a dead-lock.- Specified by:
onEventin interfaceEventListener<V>- Parameters:
e- is the event that notifies about something that happened.
-
getEvent
public ObservableEvent<V> getEvent()
- Returns:
- the last
ObservableEventthat has beenreceived. Will benullif nothing received yet.
-
getEventCount
public int getEventCount()
- Returns:
- the number of
ObservableEventsreceived.
-
-