java.lang.Object
org.palladiosimulator.analyzer.slingshot.eventdriver.internal.BusImplementation
All Implemented Interfaces:
Bus

public final class BusImplementation extends Object implements Bus
  • Constructor Details

    • BusImplementation

      public BusImplementation(String identifier)
    • BusImplementation

      public BusImplementation()
  • Method Details

    • getIdentifier

      public String getIdentifier()
      Description copied from interface: Bus
      The unique identifer of this bus. This can be generated or provided by the user.
      Specified by:
      getIdentifier in interface Bus
      Returns:
      The unique identifier.
    • register

      public <T> void register(Subscriber<T> subscriber)
      Description copied from interface: Bus
      Registers a subscriber for the event of type T. The subscriber holds a name that is used to identify it and later be unsubscribed again using Bus.unregister(Object).
      Specified by:
      register in interface Bus
      Type Parameters:
      T - The event type
      Parameters:
      subscriber - The subscriber holding the event handler.
    • register

      public void register(Object object)
      Description copied from interface: Bus
      Registers an object that contains method annotated by Subscribe annotations. This object must also be annotated with OnEvents to be correctly registered. The id of these subscribers will be the full canonical name of the method (including the name of the class).
      Specified by:
      register in interface Bus
      Parameters:
      object - The object containing subscriber methods.
    • unregister

      public void unregister(Object object)
      Description copied from interface: Bus
      Unregisters either an object containing subscriber methods, or a certain subscriber through the name. That is, the object parameter can be an arbitrary object of subscriber methods, or of type String that identifies a certain subscriber. Afterwards, those affected subscribers will be ignored upon the respective events.
      Specified by:
      unregister in interface Bus
      Parameters:
      object - The object holding the subscriber methods OR the id of the subscriber as a String.
    • post

      public void post(Object event)
      Description copied from interface: Bus
      Posts an event and calls each handler that are subscribed to, if the interceptors allow that.
      Specified by:
      post in interface Bus
      Parameters:
      event - The event to post.
    • closeRegistration

      public void closeRegistration()
      Description copied from interface: Bus
      Closes the registration of subscribers. After this method is called, it is not possible to register new objects.
      Specified by:
      closeRegistration in interface Bus
    • acceptEvents

      public void acceptEvents(boolean accept)
      Description copied from interface: Bus
      Sets whether events can be posted to this bus or not.
      Specified by:
      acceptEvents in interface Bus
      Parameters:
      accept - A flag saying whether events can be posted here. If true, then events can be posted (default behavior). If false, events are not allowed to be posted here until it is opened again.