Interface EventSubscriber<E extends SciJavaEvent>

  • Type Parameters:
    E - Type of event for which to listen
    All Superinterfaces:
    EventSubscriber<E>

    public interface EventSubscriber<E extends SciJavaEvent>
    extends EventSubscriber<E>
    Interface for subscribers that wish to be notified of SciJava events.

    There is no defined order to the notifications. This is an intentional limitation, to keep the event subsystem from growing too complex. We have found that when event handlers need to make assumptions about the order events are delivered, there is generally something wrong with the event delivery pattern in question. A better solution is to fire more granular types of events at multiple stages of the program's workflow.

    Author:
    Curtis Rueden
    • Method Detail

      • onEvent

        void onEvent​(E event)
        Description copied from interface: EventSubscriber
        Handle a published event.

        The EventService calls this method on each publication of an object that matches the class or interface passed to one of the EventService's class-based subscribe methods, specifically, EventService.subscribe(Class,EventSubscriber) EventService.subscribeExactly(Class,EventSubscriber) EventService.subscribeStrongly(Class,EventSubscriber) and EventService.subscribeExactlyStrongly(Class, EventSubscriber).

        Specified by:
        onEvent in interface EventSubscriber<E extends SciJavaEvent>
        Parameters:
        event - The Object that is being published.
      • getEventClass

        Class<E> getEventClass()