Skip to content

Instantly share code, notes, and snippets.

@ederign

ederign/Observes.java

Last active Sep 7, 2018
Embed
What would you like to do?
public void observeAllEvents(@Observes(notifyObserver = Reception.IF_EXISTS) Object event, EventMetadata metaData) {
if (shouldObserveThisEvent(event, metaData)) {
broadcast(event);
}
}
boolean shouldObserveThisEvent(Object event, EventMetadata metaData) {
return event.getClass().isAnnotationPresent(Clustered.class) && !createdOnThisClass(metaData);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment