Hello! There is an Event class, it has the heirs of LoginComletedEvent , LoadingCompletedEvent and so on.
There is a listener interface with methods
void onEventReceived(LoginComletedEvent event); void onEventReceived(LoadingCompletedEvent event); ... void onEventReceived(SomeEtcMethod event); How can I organize the sending of a specific event without creating a separate method for each Event heir?
Sort of :
public <T> void post(Class<? extends Event<T>> eventClass) { for (EventListener e : listeners) { e.onEventReceived(eventClass); } }