posted 15 years ago
Hi,
I have a large number of Enums that implement this interface:
A typical example is:
As you can imagine these methods are virtually identical in all implementations of CodableEnum. I would like to eliminate this duplication, but frankly don't know how. I tried using a class such as the following
But this turns out to be fairly useless because:
1. An enum cannot extend a class
2. Elements of an enum (SKYPE, GOOGLE_TALK, etc.) cannot extend a class
3. I cannot provide a default implementation of getByCode(), because DefaultCodableEnum is not itself an Enum. I tried changing DefaultCodableEnum to extend java.lang.Enum, but this doesn't appear to be allowed.
Any suggestions?
Thanks,
Dan Murphy
[ June 11, 2008: Message edited by: Dan Murphy ]
[ June 11, 2008: Message edited by: Dan Murphy ]