I'm using maven-jaxb2-plugin and jaxb2-basics plugin to generate java classes from a XSD schema.
I need to make some of those generated classes implement a custom interface:
public interface MyInterface<O extends MyObject> {
O getO();
O setO(O myObject);
}
So I'm using the inheritance plugin, configured in a bindings file:
<jxb:bindings node="//xs:complexType[@name='MyXmlType']">
<inheritance:implements>com.example.MyInterface</inheritance:implements>
</jxb:bindings>
How can I specify the type of the generic parameter in the implementing class (MyXmlType)? Is there an already existing plugin?
Actually it's pretty simple.
Just write the desired generic type in the binding.
<jxb:bindings node="//xs:complexType[@name='MyXmlType']">
<inheritance:implements>com.example.MyInterface<CustomMyObject></inheritance:implements>
</jxb:bindings>
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