Class EventBuilder

java.lang.Object
io.openems.common.event.EventBuilder

public final class EventBuilder extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    addArg(String identifier, T arg)
    Add an argument to EventBuilder.
    org.osgi.service.event.Event
    Build event and return it.
    from(org.osgi.service.event.EventAdmin eventAdmin, String eventTopic)
    Create new EventBuilder.
    void
    Build event and post it via given EventAdmin.
    static void
    post(org.osgi.service.event.EventAdmin eventAdmin, String eventTopic)
    Build event without arguments and post it via given EventAdmin.
    void
    Build event and send it via given EventAdmin.
    static void
    send(org.osgi.service.event.EventAdmin eventAdmin, String eventTopic)
    Build event without arguments and send it via given EventAdmin.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • from

      public static EventBuilder from(org.osgi.service.event.EventAdmin eventAdmin, String eventTopic)
      Create new EventBuilder.
      Parameters:
      eventAdmin - used eventAdmin
      eventTopic - topic of event
      Returns:
      new EventBuilder
    • post

      public static void post(org.osgi.service.event.EventAdmin eventAdmin, String eventTopic)
      Build event without arguments and post it via given EventAdmin.
      Parameters:
      eventAdmin - used eventAdmin
      eventTopic - topic of event
      Throws:
      SecurityException - If the caller does not have TopicPermission[topic,PUBLISH] for the topic specified in the event.
      See Also:
      • EventAdmin.postEvent(Event)
    • post

      public void post() throws SecurityException
      Build event and post it via given EventAdmin.
      Throws:
      SecurityException - If the caller does not have TopicPermission[topic,PUBLISH] for the topic specified in the event.
      See Also:
      • EventAdmin.postEvent(Event)
    • send

      public static void send(org.osgi.service.event.EventAdmin eventAdmin, String eventTopic)
      Build event without arguments and send it via given EventAdmin.
      Parameters:
      eventAdmin - used eventAdmin
      eventTopic - topic of event
      Throws:
      SecurityException - If the caller does not have TopicPermission[topic,PUBLISH] for the topic specified in the event.
      See Also:
      • EventAdmin.sendEvent(Event)
    • send

      public void send() throws SecurityException
      Build event and send it via given EventAdmin.
      Throws:
      SecurityException - If the caller does not have TopicPermission[topic,PUBLISH] for the topic specified in the event.
      See Also:
      • EventAdmin.sendEvent(Event)
    • build

      public org.osgi.service.event.Event build()
      Build event and return it.
      Returns:
      built Event
    • addArg

      public <T> EventBuilder addArg(String identifier, T arg)
      Add an argument to EventBuilder.
      Type Parameters:
      T - type of constant
      Parameters:
      identifier - the identifier
      arg - the actual argument
      Returns:
      same instance