> Thanks for the tip, I changed our converter to use getEnumConstants()
> now, though, did you have a look at its implementation? I'd say "butt
> ugly" ;-)

Well you piqued my curiosity. I took a look, and everything was looking good... until I got to the contents of that try clause. Massive brain trauma ensued! :P

But here's the kicker - you don't have much choice! You were already calling this method, albeit indirectly.

Your code:
EnumSet es = EnumSet.allOf(type);

Calls:
(EnumSet.allOf) EnumSet<E> result = noneOf(elementType);
(EnumSet.noneOf) Enum[] universe = elementType.getEnumConstants();

There's no escape!! Guess you might as well be using it directly...

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Mario Ivankovits wrote:
Hi Michael!
Instead of ordinalToEnum() you
could do:
return (Enum) enumType.getEnumConstants()[ordinal];
Thanks for the tip, I changed our converter to use getEnumConstants()
now, though, did you have a look at its implementation? I'd say "butt
ugly" ;-)

Ciao,
Mario






Reply via email to