users@jaxb.java.net

JAXB generating binding involving substitutionGroup head

From: Farrukh S. Najmi <farrukh_at_wellfleetsoftware.com>
Date: Wed, 20 Jun 2007 10:56:42 -0400

Hello,

I am migrating my app from JAXB 1.0 to JAXB 2.0. My schema uses
substitutionGroup feature of XSD.

A part of the schema is generating a binding that I am not understanding:

  <complexType name="RegistryObjectListType">
    <sequence>
      <element maxOccurs="unbounded" minOccurs="0" ref="tns:Identifiable"/>
    </sequence>
  </complexType>

In above, Identifiable is a complexType that is a head of a
subtitutionGroup.

Based on JAXB1.0 experience with same schema I was expecting the binding
class RegistryObjectType to generate the following methods:

    public List<IdentifiableType> getIdentifiable();

    public void setIdentifiable(List<IdentifiableType> identifiable);

Instead it is generating the following methods:

    public List<JAXBElement<? extends IdentifiableType>> getIdentifiable() {
        if (identifiable == null) {
            identifiable = new ArrayList<JAXBElement<? extends
IdentifiableType>>();
        }
        return this.identifiable;
    }

    public void setIdentifiable(List<JAXBElement<? extends
IdentifiableType>> identifiable) {
        this.identifiable = identifiable;
    }

The comment on the generated class is:

/**
 * <p>Java class for RegistryObjectListType complex type.
 *
 * <p>The following schema fragment specifies the expected content
contained within this class.
 *
 * <pre>
 * &lt;complexType name="RegistryObjectListType">
 * &lt;complexContent>
 * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 * &lt;sequence>
 * &lt;element
ref="{urn:oasis:names:tc:ebxml-regrep:xsd:rim:4.0}Identifiable"
maxOccurs="unbounded" minOccurs="0"/>
 * &lt;/sequence>
 * &lt;/restriction>
 * &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */

I would appreciate some help in understanding why the generated methods
are not the simpler ones I expected and also if there is a customization
that will yield the simpler methods.

Thanks.

-- 
Regards,
Farrukh
Web: http://www.wellfleetsoftware.com