db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Russell (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-598) Make SingleFieldIdentity classes implement Comparable
Date Thu, 26 Jun 2008 18:07:45 GMT

    [ https://issues.apache.org/jira/browse/JDO-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12608529#action_12608529
] 

Craig Russell commented on JDO-598:
-----------------------------------

Thanks for providing this patch. 

1. Yes, this should go into api2-legacy until we abandon Java 1.4.

2. We can add special treatment to ObjectIdentity later if needed but the basic functionality
is fine.

3. Can you add test cases that verify the implementation is correct? Probably sufficient to
create a few instances (of each SingleFieldIdentity type) and verify that they compare correctly.
With the test cases passing, I think this is good to go. Here's an example of what I mean:

    public void testCompareTo() {
        ByteIdentity c1 = new ByteIdentity(Object.class, (byte)1);
        ByteIdentity c2 = new ByteIdentity(Object.class, (byte)1);
        ByteIdentity c3 = new ByteIdentity(Object.class, (byte)2);
        assertEquals("Equal ByteIdentity instances compare not equal.", 0, c1.compareTo(c2));
        assertTrue("Not equal ByteIdentity instances have wrong compareTo result", c1.compareTo(c3)
< 0);
        assertTrue("Not equal ByteIdentity instances have wrong compareTo result", c3.compareTo(c1)
> 0);
    }



> Make SingleFieldIdentity classes implement Comparable
> -----------------------------------------------------
>
>                 Key: JDO-598
>                 URL: https://issues.apache.org/jira/browse/JDO-598
>             Project: JDO
>          Issue Type: Improvement
>          Components: api2
>            Reporter: Andy Jefferson
>             Fix For: JDO 2 maintenance release 2
>
>         Attachments: SingleFieldIdentity_Comparable.patch
>
>
> Would be preferable for javax.jdo.identity classes to implement Comparable so that we
can store them in a TreeSet etc

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message