Typesafe enums make sense when the underlying data really is an enumeration of values that represents the total set of valid inputs to a method. This is true, for example, when the constants are the integer subscripts into a fixed size array, and you want to avoid the possibility of IndexOutOfBound exceptions. (On the other hand, it makes iterating through the values harder.) I don't find them of much use when the constants are Strings, because in most of those scenarios the number of legal values is usually not limited -- the constants are just well-known identifiers rather than being the only valid values. For example, it wouldn't make sense to define a typesafe enum class for request attribute keys.
Another place I've found typesafe enumerations to be extremely useful is situations where the total set of values is fixed at compilation time (which is pretty much required for the pattern), and the constants themselves don't matter. In other words, you're just using them to create a well defined set for type safety, rather than caring about the constants themselves (I quite often use typesafe enumerations without underlying constants at all in fact).
Craig
Kirk Wylie M7 Corporation
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]