以下のサンプル xsd の JAXB 生成オブジェクトを生成しようとしています。
<xs:complexType name="AddressType">
<xs:sequence>
<xs:element name="USA" type="xs:string"/>
</xs:sequence>
</xs:complexType>
カスタムバインディングなしで生成されるクラスは
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AddressType", propOrder = {
"usa"
})
public class AddressType {
@XmlElement(name = "USA", required = true)
protected String usa;
/**
* Gets the value of the usa property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUSA() {
return usa;
}
/**
* Sets the value of the usa property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUSA(String value) {
this.usa = value;
}
}
ご覧のとおり、フィールド名は「usa」で、セッター/ゲッターは getUSA/setUSA です。
フィールド名を「usa」ではなく「USA」として生成するカスタム設定/バインディングはありますか?そのようにして、フィールドとプロパティはすべて「USA」になります。
How to Customize property name in JAXB?を参照しました。
しかし、それはフィールドの代わりにプロパティをカスタマイズすることです..どんな助けでも
ちなみにmaven-jaxb2-pluginを使っています