guava
guava copied to clipboard
Make the use of @Subscribe annotation optional for the EventBus handlers
Some of us need to create a bus implementing given interfaces we cannot change. The use of the @Subscribe annotation makes it very difficult to implement the interfaces.
Not working example:
public interface Bus {
<T extends Message> void send(T message);
void register(Handler handler);
}
public interface Handler<T extends Message> {
void handle(T message);
}
public class GuavaBus implements Bus {
private EventBus eventBus;
GuavaBus() {
eventBus = new EventBus();
}
@Override
public <T extends Message> void send(T message) {
eventBus.post(message);
}
@Override
public void register(Handler handler) {
eventBus.register(handler);
}
}
It's not clear to me what you're asking for. If this is still something you need, please reopen and try to explain more clearly what it is that you need to do and what you think eventbus needs to do differently to support that.