Is there a way to extend an abstract class with generic enum types? When I extend it and implement myMethod below, only the method from the abstract class gets called.
first i define abstract class with method myMethod where i would like to make decisions based on the enum value.
public abstract class MyAbstractClass <T extends enum<T>> { public void myMethod(T cmd) { //i want to override this } public void update(T cmd) { myMethod(cmd); } }
define an enum and extend the class, but the child class myMethod never gets called(only the myMethod of abstract class gets called).
enum CMD { CMD_1, CMD_2 } public class Child extends MyAbstractClass<CMD> { ... public void myMethod(CMD cmd) { if (cmd == CMD_1) { //do something } } ... }
instantiate and call
Child child = new Child(); child.update(CMD.CMD_1);