cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Anderson" <sander...@airvana.com>
Subject RE: Adding own ordering algorithm
Date Fri, 21 Nov 2008 19:42:59 GMT
If you google for a comparator for version numbers/SNMP OIDs, you can
find Java classes to do this. If you're guaranteed to always have
exactly three fields, the slickest way would be to change the schema.

Regards,
Scott

-----Original Message-----
From: Adrian Wiesmann [mailto:awiesmann@somap.org] 
Sent: Sunday, November 16, 2008 12:31 PM
To: user@cayenne.apache.org
Subject: Adding own ordering algorithm

Hello all

I have a field in a DataObject which I need for ordering and which is
formatted like this:

<number>.<number>.<number>

When ordering with the default Java order mechanism this problem arises.
The numbers are ordered like that (which is wrong in this context):

10.10.10
10.4.10
10.9.10

So I need to write my own comparator. Has anybody done so with Cayenne
before and what would you declare as the best/cleanest solution to do
so?
Subclassing Ordering, extending the compare method and use that new
class?

Thanks for your comments.

Cheers,
Adrian

Mime
View raw message