サードパーティ プロバイダーから次のようなスキーマ宣言があります。
<xs:complexType name="GroupParameterType">
<xs:sequence minOccurs="0" maxOccurs="4">
<xs:element name="name" type="xs:string">
<xs:annotation>
<xs:documentation>The name of the parameter.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="value" type="xs:string">
<xs:annotation>
<xs:documentation>The value of the parameter.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
上記は変更できないスキーマです。JavaコードでGroupParameterType.NameまたはGroupParameterType.Valueとして名前を参照できるように、jaxb 2.0のカスタムバインディングを作成しようとしています。
現在のデフォルト バインディングは、getNameandValueList などのリストを生成しますが、名前と値にそれぞれ個別のゲッターとセッターが必要です。
次のようなカスタムバインディングを入れてみました:
<jxb:bindings schemaLocation="GroupParameter.xsd" node="xs:element[@name='name']">
<jxb:globalBindings localScoping="toplevel" generateIsSetMethod="true"/>
</jxb:bindings>
<jxb:bindings schemaLocation="GroupParameter.xsd" node="xs:element[@name='value']">
<jxb:globalBindings localScoping="toplevel" generateIsSetMethod="true"/>
</jxb:bindings>
デフォルトのクラス生成を変更することは何もしませんでした。他に何を試すことができるので、誰かが私にいくつかの指針を与えることができますか? 名前と値のゲッター/セッターと一緒にデフォルトのリスト生成を行うか、名前と値を内部クラスとして持つことを探しています。maxOccurs=4 オプションを削除すると、ゲッター/セッターを生成できますが、スキーマを変更できないため、外部バインディング ファイルを使用してその動作を取得しようとしています。
ありがとう