Fragment to implement Comparable<Fragment>
public class Fragment implements Serializable, Comparable<Fragment> {
  ...
  public int compareTo(Fragment other) {
    .....
    return 0;
  }
}
With the below jaxb bindings file
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings xmlns:jxb="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:ci="http://jaxb.dev.java.net/plugin/code-injector"
    xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
    jxb:extensionBindingPrefixes="xjc" 
    jxb:version="2.1">
    <jxb:bindings>
        <jxb:globalBindings>
            <xjc:serializable uid="12343" />
        </jxb:globalBindings>
    </jxb:bindings>
    <jxb:bindings schemaLocation="../schemas/Fragment.xsd"
        version="1.0" node="/xs:schema">
        <jxb:bindings node="//xs:element[@name='Fragment']/xs:complexType">         
            <inheritance:implements>java.lang.Comparable</inheritance:implements>
            <ci:code>           
public int compareTo(Fragment other) {
    return fragmentVersion.compareTo(other.fragmentVersion);
}
            </ci:code>
        </jxb:bindings>
    </jxb:bindings>
</jxb:bindings>
Able to generate class as show below:
public class Fragment implements Serializable, Comparable {
  ...
  public int compareTo(Fragment other) {
    return fragmentVersion.compareTo(other.fragmentVersion);
  }
}
Issue: As you see, class is generated as implements Comparable instead of implements Comparable<Fragment>.
Am sure, missing something. Any help to resolve is appreciated.
While testing the solution provided by lexicore, noticed another way to resolve the issue:
<inheritance:implements><![CDATA[java.lang.Comparable<Fragment>]]></inheritance:implements>
                        JAXB2-Basics support generics.
Just use:
<inheritance:implements>java.lang.Comparable<Fragment></inheritance:implements>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With