Class TopicPrefixEventFilter

java.lang.Object
org.openhab.core.events.TopicPrefixEventFilter
All Implemented Interfaces:
EventFilter

@NonNullByDefault public class TopicPrefixEventFilter extends Object implements EventFilter
The TopicPrefixEventFilter is a default openHAB EventFilter implementation that ensures filtering of events based on the prefix of an event topic.
Author:
Cody Cutrer - Initial contribution
  • Constructor Details

    • TopicPrefixEventFilter

      public TopicPrefixEventFilter(String topicPrefix)
      Constructs a new topic event filter.
      Parameters:
      topicPrefix - the prefix event topics must start with
  • Method Details

    • apply

      public boolean apply(Event event)
      Description copied from interface: EventFilter
      Apply the filter on an event.

      This method is called for each subscribed Event of an EventSubscriber. If the filter applies, the event will be dispatched to the EventSubscriber.receive(Event) method.

      Specified by:
      apply in interface EventFilter
      Parameters:
      event - the event (not null)
      Returns:
      true if the filter criterion applies