JAXB爲每個屬性生成@XmlAttribute註釋。例如,屬性如何自定義由JAXB生成的java註釋?
<xsd:attribute name="agent_id" use="required" type="xsd:unsignedInt">
<xsd:annotation><xsd:documentation xml:lang="en">Foreign key reference to Agent.agent_id, Included in composite primary key</xsd:documentation></xsd:annotation>
</xsd:attribute>
被轉換爲帶註釋的Java對象屬性
@XmlAttribute(name = "agent_id", required = true)
@XmlSchemaType(name = "unsignedInt")
protected long agentId;
但是,如果屬性沒有在名稱中包含下劃線,在@XmlAttribute名稱字段缺失(因此##默認)。我想定製JAXB綁定,這樣也可以生成沒有下劃線的名稱的註釋。任何建議如何可以工作?
謝謝! 約翰內斯
請看[這個問題](http://stackoverflow.com/questions/8702559/adding-an-annotation-to-a-jaxb-binding-class-from-a-schema) – mthmulders