As Java provides a facility for overriding methods of an enumeration as follows:
public enum MyEnum{
ONE{
@Override
public void m(){ //do some }
},
TWO{
@Override
public void m(){ //do another somesome }
};
public abstract void m();
}
I would like to understand where it's really good to use this facility. At the first glance, It seems to be a not good decision to use such overriding ever. But in some cases it may be really convinient to do so.
My question is this:
When it's really good to use the overriding in enumerations?
For instance, in the project, I've used such a way for the enumeration consisiting of 21 enumerators
. When I start to do a feature I had only one method overriden in the enumeration, but now I have 8. So, I have the enumeration consisting of 21 enumerators any of them contains 8 overriding of the abstract methods. And it's getting harder to read the enumeration.
So, now I'm not sure about if I should use it in the project ever...
What the facility has been introduced for in Java? Maybe there're some special use-cases.