- public void publish(final Notification notification, final ExecutorService service) {
- final Iterable<Class<? extends Object>> allTypes = this.getNotificationTypes(notification);
- Iterable<NotificationListener<? extends Object>> listenerToNotify = Collections.<NotificationListener<? extends Object>>emptySet();
- for (final Class<? extends Object> type : allTypes) {
- Collection<NotificationListener<? extends Object>> _get = this.listeners.get(((Class<? extends Notification>) type));
- Iterable<NotificationListener<? extends Object>> _plus = Iterables.<NotificationListener<? extends Object>>concat(listenerToNotify, _get);
- listenerToNotify = _plus;
- }
- final Function1<NotificationListener<? extends Object>,NotifyTask> _function = new Function1<NotificationListener<? extends Object>,NotifyTask>() {
+ public <T extends Notification> NotificationListenerRegistration<T> registerNotificationListener(final Class<T> notificationType, final NotificationListener<T> listener) {
+ final NotificationListenerRegistration<T> reg = new AbstractNotificationListenerRegistration<T>(notificationType, listener) {