In order to offer specific behavior to each instance of an enum for a common public method we could do the following:
public enum Action {
a{
void doAction(...){
// some code
}
},
b{
void doAction(...){
// some code
}
},
c{
void doAction(...){
// some code
}
};
abstract void doAction (...);
}
Is there any way of giving specific implementation to an abstract generic method defined in an enum?
E.g.:
abstract<T> T doAction (T t);
I read in other questions that it shouldn't be possible, but I've been struggling for workarounds and came up with overly complicated contraptions. Maybe generics aren't the right way. Is there an easier way to achieve this?