wood burning stoves 2.0*
The moose likes Java in General and the fly likes BJO - The new Java 5 enum vs. the Type Safe Enum pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "BJO - The new Java 5 enum vs. the Type Safe Enum pattern" Watch "BJO - The new Java 5 enum vs. the Type Safe Enum pattern" New topic
Author

BJO - The new Java 5 enum vs. the Type Safe Enum pattern

Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
Jacquie,

Welcome to the Ranch. I started reading your explanation about the new Java 5 enum feature. I used this recently in a small project I am working on and it seems like a slick way to easily enumerate values, just like you described in your other posts. However, I am curious why your list of "previous solutions" does not include the Typesafe Enum pattern that is commonly used in pre-1.5 code? Can you comment on how the new 1.5 enum compares with the Typesafe Enum pattern?

Thanks,

Layne
[ July 15, 2005: Message edited by: Layne Lund ]

Java API Documentation
The Java Tutorial
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608

Can you comment on how the new 1.5 enum compares with the Typesafe Enum pattern?

The type-safe enumeration pattern was 'the inspiration' for the 1.5 enum. In fact, a 1.5 enum compiles to the same bytecode as a type-safe enum.


Tony Morris
Java Q&A (FAQ, Trivia)
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
I know the week (and the promotion) is basically over. I still would like to hear comments from the author, if she is still around.

Thanks,

Layne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BJO - The new Java 5 enum vs. the Type Safe Enum pattern
 
Similar Threads
Bit of Theory regarding Interfaces
Q. related to naming convention...
Enumerations
pattern in java constant files
Regarding type safe enum design pattern