users@jaxb.java.net

Re: Getting Enumerations using API

From: Franklin, Brian <brian.franklin_at_ciraden.com>
Date: Tue, 13 May 2003 14:28:50 -0400

While the current typesafe enum support does in fact allow for the creation
of a typesafe enum, the class that is generated does not have (as far as I
can tell) support for the feature that Brandon is describing.

To use terminology from the JAXB spec, the generated enum class has no
public static methods for retrieving the "enum constant set" or the
"enumvalue constant set".

I think the bug that Ryan referenced describes the issue fairly well and the
methods that would be necessary (
http://developer.java.sun.com/developer/bugParade/bugs/4846709.html ).

My only additional concern might be the proper behavior of the getValues()
and getMembers() methods (mentioned in the bug report / RFE) when the type
had been extended/restricted and the enum class was therefore a subclass of
another enum class.

Brian Franklin

-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Tuesday, May 13, 2003 10:41 AM
To: JAXB-INTEREST_at_JAVA.SUN.COM
Subject: Re: Getting Enumerations using API


Sorry if I'm missing something, but what's wrong with the today's type-safe
enum support? You don't need to wait for JDK1.5 to use that.

Just add:

    <jaxb:typesafeEnumClass name="ProductTypeEnum" />

to the simple type. Or is this not what you are looking for?

regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com