public class Test {
public static void main(String[] args) {
final EventBus eventBus = new EventBus();
eventBus.register(new Object() {
@Subscribe
public void lister(Integer integer) {
System.out.printf("%s from int%n", integer);
}
@Subscribe
public void lister(Number integer) {
System.out.printf("%s from Number%n", integer);
}
@Subscribe
public void lister(Long integer) {
System.out.printf("%s from long%n", integer);
}
});
// eventBus.post(1);
// eventBus.post(1L);
final EventBus eventBus1 = new EventBus();
eventBus1.register(new Object() {
@Subscribe
public void lister(DeadEvent event) {
System.out.printf("人才+ %s=%s from dead events%n", event.getSource().getClass(), event.getEvent());
}
});
eventBus1.post(new Object());
}
}
https://www.cnblogs.com/whitewolf/p/4132840.html