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:awiesman..omap.org]
Sent: Sunday, November 16, 2008 12:31 PM
To: use..ayenne.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
This archive was generated by hypermail 2.0.0 : Fri Nov 21 2008 - 14:43:59 EST