The current jdk feature of Enums does not allow the enum to inherit an abstract class. I am aware about having an abstract method inside the enum and the enum instances providing implementation for the abstract enum method. But I am trying to find a solution using Enum/abstract class workaround to the below mentioned scenario.
The reason I ask this question is I don't want to break our existing design which has an abstract class and only one abstract method and the rest of the methods are implemented methods. This abstract method is to be overriden by the derived classes. So they also inherit the complete methods defined by the parent class.
I don't want to spawn multiple derived classes but keep the implementation concise in an Enum so all the instances in enum will override the abstract method from the aforementioned abstract class.
How can I achieve this?
Udayan an enum is just like a class. Every enum extends the Enum class so they cannot extend any other class. You can achieve what you want by declaring static final fields in your class which has one abstract method or create class and use static final implementations using anonymous inner classes in it like this