問題
要素をチェックアウトするTriggerTime
と、 という要素と属性があることがわかりますTimeDate
。これは XML では問題になりませんが、デフォルトでは、JAXB 実装はこれらの項目の両方を同じ Java プロパティにマップしようとするため、競合が発生します。
<xsd:element name="TriggerTimer">
<xsd:annotation>
<xsd:documentation>BPMN: If the Trigger Type is Timer then this must be present</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:choice>
<xsd:element name="TimeDate" type="xpdl:ExpressionType"/>
<xsd:element name="TimeCycle" type="xpdl:ExpressionType"/>
</xsd:choice>
<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="TimeDate" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation>Deprecated</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="TimeCycle" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation>Deprecated</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
</xsd:element>
ソリューション (binding.xml)
外部バインディング ファイルを使用して、JAXB 実装が XML スキーマからモデル化された Java を生成する方法をカスタマイズできます。以下は、生成されたプロパティの 1 つの名前を変更する例です。
<jxb:bindings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
version="2.1">
<jxb:bindings schemaLocation="bpmnxpdl_40a.xsd">
<jxb:bindings node="//xsd:element[@name='TriggerTimer']/xsd:complexType/xsd:attribute[@name='TimeDate']">
<jxb:property name="timeDateAttr"/>
</jxb:bindings>
</jxb:bindings>
</jxb:bindings>
XJCコール
この-b
オプションは、XJC ユーティリティを使用するときにバインディング ファイルを指定するために使用されます。
xjc -b binding.xml bpmnxpdl_40a.xsd