Example #1
0
 @Override
 @SuppressWarnings("unchecked")
 public void accept(T t) {
   observable.notify(notifyKey, (wrapEvent ? Event.wrap(t) : t));
 }
Example #2
0
 /**
  * Creates a new {@code NotifyConsumer} that will notify the given {@code observable} using the
  * given {@code notifyKey}. If {@code notifyKey} is {@code null}, {@code observable} will be
  * notified without a key.
  *
  * @param notifyKey The notification key, may be {@code null}
  * @param observable The observable to notify. May not be {@code null}
  */
 public NotifyConsumer(Object notifyKey, Bus<?, ?> observable) {
   Assert.notNull(observable, "Observable cannot be null.");
   this.notifyKey = notifyKey;
   this.observable = observable;
   this.wrapEvent = EventBus.class.isAssignableFrom(observable.getClass());
 }