@Override public <T> void publish(EventScope scope, Object sender, T payload) throws UnsupportedOperationException { logger.debug("Trying to publish payload [{}] from sender [{}] using scope [{}] on event bus [{}]", payload, sender, scope, this); if (eventScope.equals(scope)) { publish(sender, payload); } else if (parentEventBus != null) { parentEventBus.publish(scope, sender, payload); } else { logger.warn("Could not publish payload with scope [{}] on event bus [{}]", scope, this); throw new UnsupportedOperationException("Could not publish event with scope " + scope); } }
@Override public <T> void publish(EventScope scope, String topic, Object sender, T payload) throws UnsupportedOperationException { logger.debug("Trying to publish payload [{}] from sender [{}] using scope [{}] on event bus [{}] in topic [{}]", payload, sender, scope, this, topic); if (eventScope.equals(scope)) { publish(topic, sender, payload); } else if (parentEventBus != null) { parentEventBus.publish(scope, topic, sender, payload); } else { logger.warn("Could not publish payload with scope [{}] on event bus [{}]", scope, this); throw new UnsupportedOperationException("Could not publish event with scope " + scope); } }
@Override public <T> void publish(EventScope scope, String topic, Object sender, T payload) throws UnsupportedOperationException { logger.debug("Trying to publish payload [{}] from sender [{}] using scope [{}] on event bus [{}] in topic [{}]", payload, sender, scope, this, topic); if (eventScope.equals(scope)) { publish(topic, sender, payload); } else if (parentEventBus != null) { parentEventBus.publish(scope, topic, sender, payload); } else { logger.warn("Could not publish payload with scope [{}] on event bus [{}]", scope, this); throw new UnsupportedOperationException("Could not publish event with scope " + scope); } }
private boolean isInterestedListenerMethod(Event<?> event) throws InstantiationException, IllegalAccessException { EventBusListenerMethod annotation = listenerMethod.getAnnotation(EventBusListenerMethod.class); EventBusListenerMethodFilter filter = annotation.filter().newInstance(); EventScope scope = annotation.scope(); if (scope.equals(EventScope.UNDEFINED)) { scope = event.getScope(); } return filter.filter(event) && event.getScope().equals(scope) && isFromSource(event, annotation.source()); }
private boolean isInterestedListenerMethod(Event<?> event) throws InstantiationException, IllegalAccessException { EventBusListenerMethod annotation = listenerMethod.getAnnotation(EventBusListenerMethod.class); EventBusListenerMethodFilter filter = annotation.filter().newInstance(); EventScope scope = annotation.scope(); if (scope.equals(EventScope.UNDEFINED)) { scope = event.getScope(); } return filter.filter(event) && event.getScope().equals(scope) && isFromSource(event, annotation.source()); }
@Override public boolean supports(Event<?> event) { boolean supports = super.supports(event); try { if (listenerMethod.isAnnotationPresent(EventBusListenerMethod.class)) { EventBusListenerMethod annotation = listenerMethod.getAnnotation(EventBusListenerMethod.class); EventBusListenerMethodFilter filter = annotation.filter().newInstance(); EventScope scope = annotation.scope(); if (scope.equals(EventScope.UNDEFINED)) { scope = event.getScope(); } supports = supports && filter.filter(event.getPayload()) && event.getScope().equals(scope); } } catch (Exception e) { throw new RuntimeException("A checked exception occurred while invoking listener method " + listenerMethod.getName(), e); } return supports; }