Inheritance plugin for JAXB2 not working on simpleTypes

1.5k views Asked by At

I have some trouble applying xjb inheritance bindings to a simpleType. Applying it to a complexType seems to work fine.

The error I get is:

compiler was unable to honor this implements customization. It is attached to a wrong place, or its inconsistent with other bindings.

My bindings look like this:

 <jaxb:bindings version="1.0"
           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
           jaxb:extensionBindingPrefixes="xjc">
    <jaxb:bindings schemaLocation="../xsd/schema.xsd" node="/xs:schema">
    <jaxb:bindings multiple="true"
                   node="//xs:complexType[substring(@name, string-length(@name)-string-length('-e')+1)='-e']">
        <inheritance:implements>mypackage.Element</inheritance:implements>
    </jaxb:bindings>
    <jaxb:bindings multiple="true"
                   node="//xs:simpleType[descendant::xs:restriction[@base='string']]">
        <inheritance:implements>mypackage.Element</inheritance:implements>
    </jaxb:bindings>
</jaxb:bindings>

And my xsd contains the following lines:

   <simpleType name="checkOut">
            <restriction base="string"/>
      </simpleType>
    <simpleType name="checkIn"> 
        <restriction base="string"/>
    </simpleType>
 <complexType name="Author-e"></complexType>

Consequently, any attempt to apply this plugin/modification to a simpleType fails. Are simpleTypes not supported by the inheritance plugin?

1

There are 1 answers

0
lexicore On BEST ANSWER

Author or the inheritance plugin here.

The plugin does not handle simple types.

If I am not mistaken, XJC does not (necessarily) generate classes for derived simple types. So you will probably not get mypackage.CheckOut or mypackage.CheckIn generated. So there will be no classes to add implements mypackage.MyElement to.