我使用maven-jaxb2-plugin和jaxb2-basics插件从XSD模式生成java类。
我需要让其中一些生成的类实现一个自定义接口:
public interface MyInterface<O extends MyObject> {
O getO();
O setO(O myObject);
}所以我使用的是在绑定文件中配置的继承插件:
<jxb:bindings node="//xs:complexType[@name='MyXmlType']">
<inheritance:implements>com.example.MyInterface</inheritance:implements>
</jxb:bindings>
如何在实现类(MyXmlType)中指定泛型参数的类型?有没有已经存在的插件?
发布于 2018-10-09 00:59:17
实际上,它非常简单。
只需在绑定中编写所需的泛型类型。
<jxb:bindings node="//xs:complexType[@name='MyXmlType']">
<inheritance:implements>com.example.MyInterface<CustomMyObject></inheritance:implements>
</jxb:bindings>https://stackoverflow.com/questions/39119923
复制相似问题