directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <>
Subject Entry and Attribute comparisons
Date Tue, 27 Apr 2010 10:00:52 GMT

just wondering how deep we should go when implementing the equals() and 
hashcode() methods :
- for an entry, is it enough to check that the DN is equal ? Otherwise, 
we will have to sort all the attributes (based on their OID, I guess), 
then for each Attribute, sort all of their value (using the normalized 
value of course, which means the Attribute is schema aware)...
- for an Attribute, as stated above, we will have somehow to sort the 
normalized values, using the specific syntax for the Attribute, 
otherwise we might not be able to compare two Attributes.

I would rather go for a simpler version of hashcode() and equals() where 
we only compare DN for entries and the attribute ID for Attribute. The 
rational is that we usually never compare entries (or we use a dedicated 
method for that : compare()), and we only need to check if an Attribute 
is stored into an Entry (speaking about the hashcode method). For the 
Attribute equals method, this is slightly different. I'm not sure we 
should compare all the values, but right now, I see no other way to do it...

Thoughts ?

Emmanuel L├ęcharny

View raw message