Direct flow depending on incoming dynamic type
- by Improfane
I have a listener class that accepts GUI change events in one method.
The incoming event objects have a superclass of a type of GUI Event, the behaviour should depend on the dynamic type of the incoming variable.
I wanted to do do lots of methods like:
handleGUIEvent(EventChangedX event)
handleGUIEvent(EventChangedY event)
I am using a single event listener and receiving objects of various types but the behaviour should be different for each. What would you do?
I do not want to use a switch statement as this would get unmaintainable.