Package org.bushe.swing.event.annotation

EventBus annotations to make it much simpler to publish and subscribe to events.

See:
          Description

Class Summary
AbstractProxySubscriber Common base class for EventService Proxies.
AnnotationProcessor Enhances classes that use EventService Annotations.
BaseProxySubscriber A class is subscribed to an EventService on behalf of another object.
ProxyTopicPatternSubscriber A Proxy Subscriber for Annotations that use topic patterns
ProxyTopicSubscriber A class that subscribes to an EventService on behalf of another object.
UseTheClassOfTheAnnotatedMethodsParameter This is a dummy class to get around a limitation with annotations.
 

Enum Summary
ReferenceStrength The two kinds of references that are used in the EventBus.
 

Annotation Types Summary
EventSubscriber An Annotation for subscribing to EventService Events.
EventTopicPatternSubscriber  
EventTopicSubscriber An Annotation for subscribing to EventService Topics.
RuntimeTopicEventSubscriber A subscriber to a topic that is determined at runtime.
RuntimeTopicPatternEventSubscriber  
VetoRuntimeTopicPatternSubscriber  
VetoRuntimeTopicSubscriber A veto subscriber to a topic that is determined at runtime.
VetoSubscriber An Annotation for adding VetoListener subscriptions to EventService Events.
VetoTopicPatternSubscriber An Annotation for adding VetoTopicPatternListener subscriptions to EventService Events.
VetoTopicSubscriber An Annotation for adding VetoTopicListener subscriptions to EventService Events.
 

Package org.bushe.swing.event.annotation Description

EventBus annotations to make it much simpler to publish and subscribe to events.

Subscription annotations remove the boilerplate inner classes that often used for subscribers, especially when one class subscribes to multiple events.

When using annotations, the AnnotationProcessor must be used to create proxy subscribers.

An annotation example:


class MySubscriber {
   @EventSubscriber(eventClass=HelloEvent.class)
   public void printOutHelloWorld(HelloEvent event) {
        System.out.println("Hello"+helloEvent.getWorld());
   }
   @EventTopicSubscriber(topic="Hello");
   public void printOutHelloWorld(String topic, Object event) {
        System.out.println(topic+" "+event);
   }
}

class HelloEventBus {
   public static void main(String args[]) {
      MySubscriber subscriber = new MySubscriber();
      AnnotationProcessor.process(subscriber);//makes a proxy subscribers
      EventBus.publish(new HelloEvent());
      EventBus.publish("Hello", "World");
   }
}



Copyright © 2011 Bushe Enterprises, Inc.. All Rights Reserved.