Hi all,

how should I handle cases where my business objects could be either "real objects" or 
proxies, and I want to override hashcode (because I've already overridden equals)?

Let's say that I'm using a proxy reference for an object A (i.e. not all As are 
proxies by default), and I put some As into a HashSet. Consider if I want to call 
mySet.remove(someA), where someA is equal to someOtherA in the Collection, but of
different types (proxy/real object), then someA will not be removed from the 
Collection, because of differences in the hashCode implementation.

In RC6, hashCode for a proxy is implemented to return the hashCode for the real 
object's Identity, so one way to solve this is to implement the same functionality in 
my business objects, but it seems like a complex solution for a not so complex
problem.

Does anyone have any good ideas? What's the reason for the IndirectionHandler not to 
delegate the hashCode functionality to the real object (as it does with equals)?

Best regards,

Mattias



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to