• Post Reply Bookmark Topic Watch Topic
  • New Topic

jaxb  RSS feed

 
barak orpeli
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
doe's anyone can post me an example for how to write wrapper class for jenerated jaxb classes.. is it simplify the work ? is it reccomended?
 
Jeya Balaji
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just sharing my experience.

I wanted to seperate my code from the generated one. That will give me flexibility in terms of re-running the jaxb to generate the classes again.

My xml had couple of nested levels of data, hence there were many type defn and many classes.

In my wrapper code, I wrote set, get for each of those different classes.

This way, my other part of the application doesnt have to invoke the JAXBContext and directly deal with the generated code. (They need not know that there are n number of classes for the xml file. All they need to know is that the xml can be worked on with the single wrapper class).

Also, the wrapper class had the logic to read and write the xml.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!