More on JAXB plugin

I’ve been talking about Java beans binding with JAXB on my old post. But trying it on my professionnal project, I’ve not been able to make it work. I encountered the following error :unrecognized parameter -Xinject-prop-listeners.

So I used another plugin, a mod of the original from jaxb-commons found on http://moscaville.com/. This one replace the vetoable events by fireChange events. It is less complete than the one from http://www.no0ne.org/, but interesting for learning more on JAXB.

First, this plugin has a two bugs :

  • boolean fields do not more generate is method but get method in the generated java source. Not very smart
  • it does not generate the firePropertyChange on int fields but only on Integer. This is more annoying : from xml xsd:int type, both int or Integer fields can be generated in Java : int are generated on required fields (minOccurence >= 1) and Integer are generated on optionnal field (minOccurence = 0). So you have to set minOccurence = 0 to your int fields in your schemas, even if in real case, there is always one occurence of the field.

Then, this plugin does not handle the lists (what the plugin of noOne does). This will be the subject of the next post.

Advertisements

About this entry