org.scijava.event
Annotation Type EventHandler


@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface EventHandler

Annotation identifying an event handler method. This annotation allows a class to subscribe to multiple types of events by implementing multiple event handling methods and annotating each with @EventHandler.

Note to developers: This annotation serves exactly the same purpose as EventBus's EventSubscriber annotation, recapitulating a subset of the same functionality. We do this to avoid third party code depending directly on EventBus. That is, we do not wish to require SciJava developers to import org.bushe.swing.event.* or similar. In this way, EventBus is isolated as only a transitive dependency of downstream code, rather than a direct dependency. Unfortunately, because Java annotation interfaces cannot utilize inheritance, we have to recapitulate the functionality rather than extend it (as we are able to do with EventSubscriber).

Author:
Curtis Rueden
See Also:
EventService



Copyright © 2009–2014 SciJava. All rights reserved.