org.bushe.swing.event.annotation
Class AnnotationProcessor

java.lang.Object
  extended by org.bushe.swing.event.annotation.AnnotationProcessor

public class AnnotationProcessor
extends Object

Enhances classes that use EventService Annotations.

This class makes the EventService annotations "come alive." This can be used in code like so:

 
 public class MyAppController {
   public MyAppController {
       AnnotationProcessor.process(this);//this line can be avoided with a compile-time tool or an Aspect
   }
   @EventSubscriber
   public void onAppStartingEvent(AppStartingEvent appStartingEvent) {
      //do something
   }
   @EventSubscriber
   public void onAppClosingEvent(AppClosingEvent appClosingEvent) {
      //do something
   }
 }
 ... some other place, needed in some cases when the like a window disposal before it's garbage collected ....
 AnnotationProcessor.unprocess(this);
 
 

This class can be leveraged in outside of source code in other ways in which Annotations are used:

Support for these other methods are not yet implemented.


Field Summary
protected static Logger LOG
           
 
Constructor Summary
AnnotationProcessor()
           
 
Method Summary
static void process(Object obj)
          Add the appropriate subscribers to one or more EventServices for an instance of a class with EventBus annotations.
static void unprocess(Object obj)
          Remove the appropriate subscribers from one or more EventServices for an instance of a class with EventBus annotations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final Logger LOG
Constructor Detail

AnnotationProcessor

public AnnotationProcessor()
Method Detail

process

public static void process(Object obj)
Add the appropriate subscribers to one or more EventServices for an instance of a class with EventBus annotations.

Parameters:
obj - the instance that may or may not have annotations

unprocess

public static void unprocess(Object obj)
Remove the appropriate subscribers from one or more EventServices for an instance of a class with EventBus annotations.

Parameters:
obj - the instance that may or may not have annotations


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