Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sorting value objects  RSS feed

 
Diane Williamson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I currently use xdoclet to create my value objects.

Now I wish to implement compareTo in my value objects, so that I can sort them later. How can I use xdoclet to do this for me?
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you could create a template that puts that method in the code. But wouldn't each value object be sorted in different ways? so the compareTo method would have to have different type of code. If there is a way you can create a new XDoclet tag to tag attributes that need to be included in the compareTo, then you do that and use those tags in your code to flag the attributes, and in the template to make sure it loops through those attributes and writes code to compare them in your compareTo method.

Mark
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!