users@jaxb.java.net

Re: xsd:choice and jaxb2-reflection

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 22 Jun 2007 16:14:06 -0700

Hunor Bartha wrote:
> i have another question about the reflection library. I am writing an
> xml editor app, that uses jaxb, and generates the gui at runtime from
> the generated jaxb objects, using the reflection library.

Cool.

> I have a problem with the properties that are defined in the schema as
> xsd:choice. Is there a way to figure out, using the reflection library
> that a property is one possible value of a choice.

No. That information is not retained on the generated classes. The
compiler model inside XJC (and they implement the same interfaces) does
have this info (in some indirect way.)

> My problem is that
> currently i have no way of deciding if i have a property that has a null
> value if that is an optional node, or a possible value for a choice.
> Any pointers to the right direction are welcome...

It is completely indistinguishable from the runtime point of view.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com