Skip to content

Instantly share code, notes, and snippets.

@abhirockzz
Last active December 17, 2015 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhirockzz/def697b68e719a06a1c6 to your computer and use it in GitHub Desktop.
Save abhirockzz/def697b68e719a06a1c6 to your computer and use it in GitHub Desktop.
Example of a simple CDI event with a static qualifier
//firing a (statically) qualified event
@Inject
@Approved
private Event<RequestOutcome> outcomeEvent;
public void notify(){
outcomeEvent.fire(outcomeEvent.getOutcome());
}
//observers
public void handleApprovedRequest(@Observes @Approved RequestOutcome approvedOutcome){
//logic...
}
public void handleRejectedRequest(@Observes @Rejected RequestOutcome rejectedOutcome){
//logic...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment