Interface Event


public interface Event
Represents an event to be handled by Element instances.
  • Field Details

    • SYSTEM_EVENT_PREFIX

      static final String SYSTEM_EVENT_PREFIX
      All event names with the following prefix are considered system events. Applications should not use events prefixed with this string.
      See Also:
  • Method Details

    • isSystemEvent

      default boolean isSystemEvent()
      True if the event is a system event.
      Returns:
      true if system event, false otherwise.
    • getEventName

      String getEventName()
      The Event name. The names of events are application specific. However, they should follow a globally unique naming pattern. Additionally, SYSTEM_EVENT_PREFIX prefixed events are reserved for the SDK and should not be used.
      Returns:
      the name of hte event.
    • getEventArguments

      List<Object> getEventArguments()
      Get the arguments of the Event. When using argument-based matching, each argument must be non-null and must match based on exact class type. The dispatch mechanism does not honor polymorphism.
      Returns:
      the arguments
    • getEventArgument

      default <T> T getEventArgument(int index)
      Gets the argument at the specified index. The index must be within the bounds of the event arguments list.
      Type Parameters:
      T - the type of the argument to retrieve
      Parameters:
      index - the index of the argument to retrieve
      Returns:
      the argument at the specified index
    • getEventArgument

      default <T> T getEventArgument(int index, Class<T> type)
      Gets the argument at the specified index. The index must be within the bounds of the event arguments list. Similar to getEventArgument(int), thie enforces more predictable exception behavior by requiring the type to be explicitly named in the method call.
      Type Parameters:
      T - the type of the argument to retrieve
      Parameters:
      index - the index of the argument to retrieve
      Returns:
      the argument at the specified index
    • builder

      static Event.Builder builder()
      Returns a new Event.Builder for Event instances.
      Returns:
      the Event.Builder