users@jaxb.java.net

Re: enum types and generated constants?

From: Dmitri Colebatch <colebatchd_at_gmail.com>
Date: Tue, 14 Jun 2005 09:51:30 +1000

Hi,

Thanks for the response. I'm interested in 2.0, we're currently using
the jaxb-ri-20050407 download. Was this fixed after that release? I
assume it was as the attached schema doesn't generate anything I can
see to use for the Test element when I call xjc test.xsd.

Do I need to add command line parameters? Or is it simply a case of I
need a newer version. I'm assuming the latter as I cant see anything
that looks relevant in the xjc output.

cheers
dim

On 6/14/05, Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_sun.com> wrote:
> Dmitri Colebatch wrote:
> > Hi all,
> >
> > We're in the process of migrating from XmlBeans to JAXB 2.0 and one of
> > the things we're missing is generated constants for enum types. I'm
> > hoping that this is a case of me not looking in the right place for
> > what I'm looking for and someone will be able to simply point me in
> > the right direction.
>
> In 1.0, by default, we bind simpleTypes to type-safe enums only if it's
> derived from NCName. You can change this by using a customization like
> this to include xsd:token as a potential candidate for the type-safe
> enum binding:
>
> <jaxb:globalBindings typesafeEnumBase="xsd:token" />
>
> See some of the bundled samples for how to add <globalBindings>
> customization.
>
>
> In 2.0, this usability issue is fixed, and I just confirmed that it does
> generate an enum class out of the box for your simple type.
>
>
> --
> Kohsuke Kawaguchi
> Sun Microsystems kohsuke.kawaguchi_at_sun.com
>
>
>