users@jaxb.java.net

RE: When will xjc create a Boolean, and when a boolean?

From: KARR, DAVID (ATTSI) <"KARR,>
Date: Thu, 25 Mar 2010 08:42:24 -0700

> -----Original Message-----
> From: KARR, DAVID (ATTSI)
> Sent: Wednesday, March 24, 2010 6:03 PM
> To: users_at_jaxb.dev.java.net
> Subject: When will xjc create a Boolean, and when a boolean?
>
> I'm seeing two different elements defined in related schemas, and
> comparing the code generated from that schema. Both elements are
> defined with 'type="xs:boolean"'. Neither of them have a "minOccurs"
> or
> "default" attribute. One of them is generated in the Java code as
> "Boolean", and the other "boolean". Why would xjc make one property
> "Boolean" and the other "boolean"?
>
> The schema excerpt that produces "Boolean" is this:
>
> <xs:sequence>
> <xs:choice>
> <xs:element maxOccurs="unbounded" name="ListOfStuff"
> type="tns:ListItemType">
> </xs:element>
> <xs:sequence>
> <xs:element name="isFlag" type="xs:boolean">
> </xs:element>
>
> The schema excerpt that produces "boolean" is this:
>
> <xs:complexType>
> <xs:sequence>
> <xs:element name="isFlag" type="xs:boolean">
> </xs:element>
>
> The latter complexType is defined inside another one, so the resulting
> code is defined inside a static inner class, where the outer class
> defines the outer complex type.

I guess I understand this now. The "Boolean" object is defined because
it's inside a "choice" structure. Since JAXB doesn't map the "choice"
directly, all the elements in the choice branch have to be nullable
objects.

>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net