posted 11 years ago
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.