>>>>> "Paul" == Paul Landes <[EMAIL PROTECTED]> writes:
Paul> Phillip Lord writes: >> It's possible to do this using a super class. I use the class >> following. Paul> This is one approach. Both have their advantages and Paul> disadvantages. It might be a bad idea to use inheritance for Paul> immutable instances because now your sharing implementation Paul> details across classes. I thought sharing implementation between classes was the point of inheritance. Paul> You can give your super class some unique identifier, but as Paul> you add more things (i.e. description, identifiers, sub enums, Paul> etc.) you now have to consider these changes in overriden Paul> java.lang.Object methods like equal() and hashCode() for both Paul> performance and maintenance reasons. Perhaps I am missing the point again. It's a enum. equal() is never overridden because an == comparison is what you want. Paul> I like the template approach because this gives me a template Paul> to work with, then I can specialize it for what I need. I often add new things to my enums though. Mostly I inherit straight from the AbstractEnumeration I sent it. Sometimes I create another generic subclass in between. Perhaps I'm being biased here. It's just templated code where inheritance will work gives me the willies. >> I also wonder whether its worth doing this when Java is getting >> language support for Enums in 1.5.... Paul> Perhaps not. There are many of us that are still on, and will Paul> be stuck on 1.4, for a while. I my situation, we have to pick Paul> and commit to a J2EE application server. J2EE vendors tend to Paul> be slow to upgrade Java versions. True enough. I work in research so we can generally use what ever we like! I understand that most people don't have this luxury (or curse depending on how you look at it!). Cheers Phil