roboguice.event
Annotation Type Observes
@Retention(value=RUNTIME)
@Target(value=PARAMETER)
public @interface Observes
Parameter annotation to bind a given method and parameter to an event raised through the
EventManager.fire() method.
Please note that a runtime exception will be thrown if more than one parameter is annotated or more than one parameter
exists in the method definition.
Example of proper use:
ContextEvent event = new ContextEvent(EventParameter.class, new EventParameter("data"));
eventManager.fire(context, event);
triggers:
public void handleEvent(@Observes EventParameter event){
String data = event.getData() // "data"
}
- Author:
- Adam Tybor, John Ericksen
Copyright © 2011. All Rights Reserved.