0
在我的xsd模式中,我有一個complexType「表達式」,其中有27個元素,它們都擴展了一個常見的complexType「StepElement」。這裏是表達複雜類型的樣本。(爲簡單起見,我只顯示其中8人)。JAXB生成可笑的奇怪和長的方法名稱
<xs:complexType name="expression">
<xs:sequence maxOccurs="unbounded">
<xs:element name="STEP_ANIMATION" type="Animation_Attributes" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="STEP_EXPECT_REPLY" type="Expect_Reply_Attributes" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="STEP_RESTART" type="Restart_Attributes" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="STEP_REDIRECT" type="Redirect_Attributes" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="STEP_SUBGOAL" type="Subgoal_Attributes" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="STEP_TIMER" type="Timer_Attributes" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="STEP_SITUATION" type="Situation_Attributes" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="STEP_SOUND" type="Sound_Attributes" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="ID" type="xs:integer"/>
<xs:attribute name="SUCCESS_EVT" type="xs:string"/>
<xs:attribute name="DELAY" type="xs:float"/>
</xs:complexType>
當這些元素類型的像這樣(它們都繼承StepElement但具有不同的屬性)
<xs:complexType name="Animation_Attributes">
<xs:complexContent>
<xs:extension base="StepElement">
<xs:attribute name="AGENT" type="xs:string" default="$CURRENTBOT"/>
<xs:attribute name="SUCCESS_EVT" type="xs:string"/>
<xs:attribute name="FAIL_EVT" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
這裏是StepElement怎麼看起來像
<xs:complexType name="StepElement">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="ID" type="xs:integer"/>
<xs:attribute name="ENGLISH" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
現在,我有這樣的問題,當我分析這個模式,使JAXB生成的getter方法表達類是這個
public List<StepElement> getSTEPANIMATIONAndSTEPEXPECTREPLYAndSTEPRESTART()
我在做一些錯誤是導致這種情況發生,還是有來調整方法名的解決方案架構的結構?
我研究了定製JAXB綁定的文檔,但沒有提到有關定製方法名稱的任何信息:/。 –
下面是一個例子。 http://stackoverflow.com/questions/4502229/how-do-you-customize-how-jaxb-generates-plural-method-names – austin
謝謝。它完美的作品。 –