Reputation: 1471
I try to add a superclass definition to a generated class based on an incoming XML complexType. When I make the mapping generic, like this, it works:
<jaxb:globalBindings generateElementProperty="false">
<xjc:superClass name="nl.ilent.bpo.interceptor.Hashable" />
</jaxb:globalBindings>
Now I want only one type to subclass this class. I tried many selectors, but this is the only one that finds exactly one type:
<jaxb:bindings schemaLocation="../xsd/OrganisatieTypes.xsd" node="//xs:complexType[@name='DatumIncompleetType']">
<xjc:superClass name="nl.ilent.bpo.interceptor.Hashable" />
</jaxb:bindings>
Even though many alternatives gave a "0 nodes" result, and this one does not, the generated class does not subclass Hashable. What am I doing wrong?
This is the XSD defining the complexType in ../xsd/OrganisatieTypes.xsd:
<xsd:complexType name="DatumIncompleetType">
<xsd:choice minOccurs="0">
<xsd:element name="datum" type="xsd:date"/>
<xsd:element name="jaarMaand" type="xsd:gYearMonth"/>
<xsd:element name="jaar" type="xsd:gYear"/>
</xsd:choice>
</xsd:complexType>
We are using CXF 2.7.18
Upvotes: 0
Views: 314
Reputation: 610
Try this way
<jaxb:bindings schemaLocation="../xsd/OrganisatieTypes.xsd" node="/xs:schema">
<jaxb:bindings>
<jaxb:bindings node="//xs:complexType[@name='DatumIncompleetType']">
<xjc:superClass name="nl.ilent.bpo.interceptor.Hashable" />
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
Edit
Ok, sorry, that won't work: according to https://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/2.0/jaxb/vendorCustomizations.html#superclass this is only possible for global bindings, i.e. for all generated classes, not for single generated classes
Upvotes: 1