Interface EventFactory

All Known Implementing Classes:
AbstractEventFactory, AddonEventFactory, AutomationEventFactory, ConfigStatusEventFactory, FirmwareEventFactory, InboxEventFactory, ItemEventFactory, LinkEventFactory, SystemEventFactory, ThingEventFactory

@NonNullByDefault public interface EventFactory
An EventFactory is responsible for creating Event instances of specific event types. Event Factories are used to create new Events (createEvent(String, String, String, String)) based on the event type, the topic, the payload and the source if an event type is supported (getSupportedEventTypes()).
Author:
Stefan Bußweiler - Initial contribution
  • Method Details

    • createEvent

      Event createEvent(String eventType, String topic, String payload, @Nullable String source) throws Exception
      Create a new event instance of a specific event type.
      Parameters:
      eventType - the event type
      topic - the topic
      payload - the payload
      source - the source (can be null)
      Returns:
      the created event instance (not null)
      Throws:
      IllegalArgumentException - if eventType, topic or payload is null or empty
      IllegalArgumentException - if the eventType is not supported
      Exception - if the creation of the event has failed
    • getSupportedEventTypes

      Set<String> getSupportedEventTypes()
      Returns a list of all supported event types of this factory.
      Returns:
      the supported event types (not null)