If you want to have one EventHandler class with overloaded methods, and your event types do not have any subclasses, then this simple code that uses reflection should work:
public class EventHandler { public void handle (final PlayerMove move) {
However, if you want to have a separate EventHandler for different events, it would be better.
public interface EventHandler<T extends Event> { void handle (T event); } public class PlayerMoveEventHandler implements EventHandler<PlayerMove> { @Override public void handle (final PlayerMove event) {
source share