Deriving a complexType by restriction must repeat all the particle
components
of the base type, providing more restrictive facets or simple types.
Once the base type is mapped to a Java class, its properties are fixed; in
Java
there is no way to "override" the types of fields of a supertype in its
subtype.
The wildcard particle in PayloadType is mapped to List<Object> any, and this
property is what will contain the EndDeviceEvents element data from a
EndDeviceEventsPayloadType.
-W
On 12 May 2011 23:22, Daniel Kan <dkan_at_silverspringnet.com> wrote:
> I'm using xjc maven plugin to generate java classes from xsds, but am
> encountering some inheritance problem. I have two complexTypes:
> EndDeviceEventsPayloadType and PayloadType. EndDeviceEventsPayloadType
> inherits from PayloadType and additionally contains a reference to
> EndDeviceEvents via xs:restriction. The problem is that this reference
> fails to show up in the generated EndDeviceEventsPayloadType class.
> EndDeviceEventsPayloadType simply extends PayloadType as shown below. I
> would like to see a field called endDeviceEvents to show up in the
> EndDeviceEventsPayloadType class. I haven't yet tried custom bindings.
> Thanks in advance for any help.
>
> Dan
>
>
>
> /**
> * <p>Java class for EndDeviceEventsPayloadType complex type.
> *
> * <p>The following schema fragment specifies the expected content
> contained within this class.
> *
> * <pre>
> * <complexType name="EndDeviceEventsPayloadType">
> * <complexContent>
> * <restriction
> base="{http://www.iec.ch/TC57/2010/schema/message}PayloadType">
> * <sequence>
> * <choice>
> * <element
> ref="{http://iec.ch/TC57/2009/EndDeviceEvents#}EndDeviceEvents"/>
> * <element name="Compressed"
> type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
> * </choice>
> * <element name="Format"
> type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
> * </sequence>
> * </restriction>
> * </complexContent>
> * </complexType>
> * </pre>
> *
> *
> */
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "EndDeviceEventsPayloadType")
> public class EndDeviceEventsPayloadType
> extends PayloadType
> {
>
>
> }
>
>
> /**
> * Payload container
> *
> * <p>Java class for PayloadType complex type.
> *
> * <p>The following schema fragment specifies the expected content
> contained within this class.
> *
> * <pre>
> * <complexType name="PayloadType">
> * <complexContent>
> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
> * <sequence>
> * <choice>
> * <any namespace='##other' maxOccurs="unbounded"
> minOccurs="0"/>
> * <element name="Compressed"
> type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
> * </choice>
> * <element name="Format"
> type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
> * </sequence>
> * </restriction>
> * </complexContent>
> * </complexType>
> * </pre>
> *
> *
> */
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "PayloadType", propOrder = {
> "any",
> "compressed",
> "format"
> })
> @XmlSeeAlso({
> EndDeviceEventsPayloadType.class
> })
> public class PayloadType {
>
> @XmlAnyElement(lax = true)
> protected List<Object> any;
> @XmlElement(name = "Compressed")
> protected String compressed;
> @XmlElement(name = "Format")
> protected String format;
>
>
>
>