• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in using xstream annotations for complex java objects

 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a java object - Entity.java



I want to convert Entity.java to xml in the following format -



I have done something like this -


How do i annotate location and country?

Thanks.



 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deeps Mistry wrote:Hi,

I have a java object - Entity.java



I want to convert Entity.java to xml in the following format -



I have done something like this -


How do i annotate location and country?

Thanks.





Can anyone please help me out with this?

Thanks
 
g tsuji
Ranch Hand
Posts: 656
3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i annotate location and country?

With the layout given, you practically no need to annotate location. For country, you simply alias the variable to country.

Most of the tag names will fall in place because you make the variable names conducive to the intended output.

Or do I miss something you have not shown (apart from those getters or setters or constructors...)?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic