Package org.openhab.core.items.events
Class AbstractItemEventSubscriber
java.lang.Object
org.openhab.core.items.events.AbstractItemEventSubscriber
- All Implemented Interfaces:
EventSubscriber
@NonNullByDefault
public abstract class AbstractItemEventSubscriber
extends Object
implements EventSubscriber
The AbstractItemEventSubscriber
defines an abstract implementation of the EventSubscriber
interface
for receiving ItemStateEvent
s and ItemCommandEvent
s from the openHAB event bus.
A subclass can implement the methods receiveUpdate(ItemStateEvent)
and
receiveCommand(ItemCommandEvent)
in order to receive and handle such events.
- Author:
- Stefan Bußweiler - Initial contribution
-
Field Summary
Fields inherited from interface org.openhab.core.events.EventSubscriber
ALL_EVENT_TYPES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the event types to which the event subscriber is subscribed to.void
Callback method for receivingEvent
s from the openHAB event bus.protected void
receiveCommand
(ItemCommandEvent commandEvent) Callback method for receiving item command events from the openHAB event bus.protected void
receiveTimeSeries
(ItemTimeSeriesEvent timeSeriesEvent) Callback method for receiving item timeseries events from the openHAB event bus.protected void
receiveUpdate
(ItemStateEvent updateEvent) Callback method for receiving item update events from the openHAB event bus.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openhab.core.events.EventSubscriber
getEventFilter
-
Constructor Details
-
AbstractItemEventSubscriber
public AbstractItemEventSubscriber()
-
-
Method Details
-
getSubscribedEventTypes
Description copied from interface:EventSubscriber
Gets the event types to which the event subscriber is subscribed to.- Specified by:
getSubscribedEventTypes
in interfaceEventSubscriber
- Returns:
- subscribed event types (not null)
-
receive
Description copied from interface:EventSubscriber
Callback method for receivingEvent
s from the openHAB event bus. This method is called for every event where the event subscriber is subscribed to and the event filter applies.- Specified by:
receive
in interfaceEventSubscriber
- Parameters:
event
- the received event (not null)
-
receiveCommand
Callback method for receiving item command events from the openHAB event bus.- Parameters:
commandEvent
- the item command event
-
receiveUpdate
Callback method for receiving item update events from the openHAB event bus.- Parameters:
updateEvent
- the item update event
-
receiveTimeSeries
Callback method for receiving item timeseries events from the openHAB event bus.- Parameters:
timeSeriesEvent
- the timeseries event
-