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 ItemStateEvents and ItemCommandEvents 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
  • Constructor Details

    • AbstractItemEventSubscriber

      public AbstractItemEventSubscriber()
  • Method Details

    • getSubscribedEventTypes

      public Set<String> getSubscribedEventTypes()
      Description copied from interface: EventSubscriber
      Gets the event types to which the event subscriber is subscribed to.
      Specified by:
      getSubscribedEventTypes in interface EventSubscriber
      Returns:
      subscribed event types (not null)
    • receive

      public void receive(Event event)
      Description copied from interface: EventSubscriber
      Callback method for receiving Events 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 interface EventSubscriber
      Parameters:
      event - the received event (not null)
    • receiveCommand

      protected void receiveCommand(ItemCommandEvent commandEvent)
      Callback method for receiving item command events from the openHAB event bus.
      Parameters:
      commandEvent - the item command event
    • receiveUpdate

      protected void receiveUpdate(ItemStateEvent updateEvent)
      Callback method for receiving item update events from the openHAB event bus.
      Parameters:
      updateEvent - the item update event
    • receiveTimeSeries

      protected void receiveTimeSeries(ItemTimeSeriesEvent timeSeriesEvent)
      Callback method for receiving item timeseries events from the openHAB event bus.
      Parameters:
      timeSeriesEvent - the timeseries event