javamavenjpajaxbhyperjaxb

Setting hyperjaxb mapping to force implementation of external interface


I have an hyperjaxb xsd file and binding configuration. How can I force my generated classes to implement a custom interface declared in another artifact? I know I can make them extend another class by using

    <xjc:superClass name="com.sample.jpa.entities.BaseEntity"/>

But I need them to implement another interface also. How can I achieve that?


Solution

  • Disclaimer: Author of Hyperjaxb and JAXB2-Basics here.

    You can use the Inheritance plugin from JAXB2-Basics together with Hyperjaxb. You can both extend a class or implement an interface. The plugin can also process generics so you can even do stuff like <inheritance:implements>com.acme.foo.MyInterface&lt;com.acme.foo.SomeClass&gt;</inheritance:implements>.

    Short guide:

    That should be it.