Package org.openhab.core.events
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 Summary
Modifier and TypeMethodDescriptioncreateEvent(String eventType, String topic, String payload, @Nullable String source) Create a new event instance of a specific event type.Returns a list of all supported event types of this factory.
-
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 typetopic- the topicpayload- the payloadsource- the source (can be null)- Returns:
- the created event instance (not null)
- Throws:
IllegalArgumentException- if eventType, topic or payload is null or emptyIllegalArgumentException- if the eventType is not supportedException- if the creation of the event has failed
-
getSupportedEventTypes
Returns a list of all supported event types of this factory.- Returns:
- the supported event types (not null)
-