- Type Parameters:
T- The specific event type this class subscribes to.
- All Implemented Interfaces:
@NonNullByDefault public abstract class AbstractTypedEventSubscriber<T extends Event> extends Object implements EventSubscriber
AbstractTypedEventSubscriberis an abstract implementation of the
EventSubscriberinterface which helps to subscribe to a specific event type. To receive an event - casted to the specific event type - the
receiveTypedEvent(T)method must be implemented. This implementation provides no event filter. To filter events based on the topic or some content the
EventSubscriber.getEventFilter()method can be overridden.
- Stefan Bußweiler - Initial contribution
Method SummaryModifier and TypeMethodDescriptionGets the event types to which the event subscriber is subscribed to.
voidCallback method for receiving
Events from the openHAB event bus.
protected abstract voidCallback method for receiving typed events of type T.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
(String eventType)Constructs a new typed event subscriber. Must be called in the subclass.
eventType- the event type
getSubscribedEventTypesDescription copied from interface:
EventSubscriberGets the event types to which the event subscriber is subscribed to.
receivepublic void receive
(Event event)Description copied from interface:
EventSubscriberCallback 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.
receiveTypedEventprotected abstract void receiveTypedEvent
(T event)Callback method for receiving typed events of type T.
event- the received event