使用JAXB获取布尔属性的getter [英] getter for boolean properties with JAXB
问题描述
我试图使用jax-ws公开服务,但我得到的第一个惊喜是Weblogic不支持请求/响应对象的内部类。在克服了这种情况后,此处,我正面临另一项挑战:
I´m trying to expose services using jax-ws but the first surprise i got was that Weblogic does not support inner classes for request/response objects. After get over this situation here, i´m facing another challenge:
生成 getXXX()
而不是 isXXX()
方法。
我需要生成此方法,因为当我启动服务时,我收到消息:
I need to generate this methods cause when i start the service i get the message:
<WS data binding error>could not find getter for property 'IsXXX' on com.foo.MyClass
尝试过定制:
<jaxb:globalBindings generateIsSetMethod="false" enableJavaNamingConventions="false">
无效。 :(
任何帮助?
推荐答案
JAXB的BooleanGetter XJC插件可在 http: //fisheye5.cenqua.com/browse/~raw,r=1.1/jaxb2-commons/www/boolean-getter/index.html
BooleanGetter XJC plugin for JAXB is available at http://fisheye5.cenqua.com/browse/~raw,r=1.1/jaxb2-commons/www/boolean-getter/index.html
如果您正在使用JavaSE 6,然后需要重新打包 - 请参阅 http: //forums.java.net/jive/message.jspa?messageID=319434
If you are working with JavaSE 6 then it needs to be re-packaged - see http://forums.java.net/jive/message.jspa?messageID=319434
在ant build中使用如下所示:
Use in ant build like below:
<taskdef name="xjc" classname="com.sun.tools.xjc.XJCTask" classpathref="development.classpath"/>
<xjc schema="some.xsd" package="com.acme.jaxb" destdir="gen-src">
<arg value="-Xcollection-setter-injector"/>
<arg value="-Xboolean-getter"/>
</xjc>
HTH
这篇关于使用JAXB获取布尔属性的getter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!