org.bitbucket.gkutiel.Channel Maven / Gradle / Ivy
package org.bitbucket.gkutiel;
public final class Channel {
private static final Bus bus = new Bus();
public static Channel channel(final String name, final Class type) {
return new Channel(name, type);
}
private final String key;
private final Class type;
private Channel(final String key, final Class type) {
this.key = key;
this.type = type;
}
public void pub(final T val) {
bus.pub(key, val);
}
public void sub(final Callback callback) {
bus.sub(key, type, callback);
}
}