我正在尝试在我的 xjb 生成的存根上添加不推荐使用的注释。
<jaxb:bindings schemaLocation="../../../../../server/target/schemas/schema2.xsd">
<jaxb:bindings node="xs:complexType[@name='someForms']/xs:all/xs:element[@name='detailsForm']">
<annox:annotate target="getter">@java.lang.Deprecated</annox:annotate>
</jaxb:bindings>
</jaxb:bindings>
它不会失败,但不会将 xml 属性放在字段上。这就是 xsd 的外观 -
<xs:complexType name="approvalForms">
<xs:all>
<xs:element name="detailsForm" type="formRef" minOccurs="0"/>
</xs:all>
</xs:complexType>
但是,以下工作
<jaxb:bindings schemaLocation="../../../../../server/target/schemas/schema2.xsd">
<jaxb:bindings node="xs:complexType[@name='someForms']">
<annox:annotate>
<annox:annotate annox:class="org.codehaus.jackson.annotate.JsonTypeName"
value="SomeForm" />
</annox:annotate>
</jaxb:bindings>
我错过了什么吗?如何在 stub 的 getDetailsForm() 上添加 @Deprecated ?