org.bushe.swing.event.annotation
Class AnnotationProcessor
java.lang.Object
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: - In an
Aspect-Oriented tool
- In a Swing Framework classloader that wants to load and understand events.
- In other
Inversion of Control containers, such as Spring or PicoContainer.
- In the apt tool, though this does not generate
code.
- In a Annotation Processing Tool plugin, when it becomes available.
Support for these other methods
are not yet implemented.
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 |
LOG
protected static final Logger LOG
AnnotationProcessor
public AnnotationProcessor()
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.