如何使用Jaxb Xjc更改getter的实现?

时间:2013-11-30 11:44:17

标签: xml xsd jaxb2 xjc

我有以下xsd架构:                                                                                                          

  <xsd:complexType name="USAddress">
    <xsd:sequence>
         <xsd:element name="name" type="xsd:string"/>
         <xsd:element name="street" type="xsd:string"/>
         <xsd:element name="city" type="xsd:string"/>
         <xsd:element name="state" type="xsd:string"/>
         <xsd:element name="zip" type="xsd:decimal"/>
     </xsd:sequence>
     <xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/>
   </xsd:complexType>
 </xsd:schema>

我,使用此命令为它创建实体         xjc -p primer.po2 -d src2 po2.xsd 我的问题是我如何在getter中添加逻辑,例如在字符串将小写字母设置为大写字母并修剪字符串的情况下。 感谢

1 个答案:

答案 0 :(得分:0)

发现它只是使JBlock myMethod = method.body();         myMethod.pos(0); pos函数将使您处于方法块的开头