Tuesday, October 4, 2016

Enum

As described in the Sun/OracleJava documentation, a Java enum “you should use enum types any time you need to represent a fixed set of constants

No, enums are supposed to be a complete static enumeration.
At compile time, you might want to generate your enum .java file from another source file of some sort. You could even create a .class file like this.
In some cases you might want a set of standard values but allow extension. The usual way to do this is have an interface for the interface and an enum that implements that interface for the standard values. Of course, you lose the ability to switch when you only have a reference to the interface.