I was trying to sort elements from a collection of value objects, so I use Collections Collections.sort(list); where list is a ArrayList.
To use this class its necesary that your ValueObject implements Comparable, and extends the method compareTo. This method is like this:
// // Attention: Generated code! Do not modify by hand! // Generated by: ValueObject.vsl in andromda-java-cartridge. // package com.xxx.XX;
/**
*
*/
public class VOProduct
implements java.io.Serializable,Comparable
{
private java.lang.String word;
...............................................
public int compareTo(Object arg0) {
VOProduct voProduct= (VOProduct ) arg0;
return word.compareTo(voProduct.getword()); // voProduct.getword() must implements the interface Comparable
}
....
}
In /andromda-all/cartridges/andromda-java/src/templatesa/java/ValueObject
you can add this if the field that you are going to search is always the same (for example Name). Bu
So, could be possible to add a taggedvalue (passing a parameter where define the field that must be sort )that inserts the method compareTo in the valueObject ?
Thx
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
Andromda-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-user
