Annotation Type EventConsumer


  • @Retention(RUNTIME)
    public @interface EventConsumer
    If you want an instance of a class to get notified when an event of a concrete type is fired, just add this annotation to the method which consumes that event object.

    Example:
         // An event consumer
         class MyEventConsumer {
             //...
            @EventConsumer
            public void eventTypeChanged(EventType eventType) {
                // do something..
            }
             //...
         }
    
         // some event producer which publishes the event through the EventRegistry
         EventProducer producer = new EventProducer();
         producer.fireEvent(new EventType());