You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Daniel Peter <dp...@yahoo.de> on 2007/05/11 11:21:23 UTC

SDO generator: equals and hashcode

Hi all,

I see that the EqualityHelper provides the logic for
determining the equality of SDOs.
Is there a way to make the generator produce 'equals'
and 'hashcode' methods in the generated SDO classes?

Thanks, Daniel.


      __________________________________  Kennt man wirklich jeden über 3 Ecken? Die Antworten gibt's bei Yahoo! Clever. www.yahoo.de/clever

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: SDO generator: equals and hashcode

Posted by kelvin goodson <ke...@gmail.com>.
Daniel,
   sound a good proposal.   This raises all sorts of questions in my mind,
and I'm not an expert in this area.  Have you any detailed thoughts about
how this might work out?  Here's my first, possibly slightly jumbled
reactions ...

I think this would be a trip hazard if it were only done on the static API,
so I think it's a spec issue.  It would be a severe limitation for code to
have to know when it was dealing with dynamic or static data objects,  and
graphs of mixed objects would present a problem for generic code.  We could
add an SDOUtil method that produces the Tuscany concept of a hashCode for
dynamic or static data objects.

Would you imagine that the generator creates a bespoke equality method per
class, or defer to the EqualityHelper?

Currently we rely on the EMF EqualityHelper to underpin Tuscany's SDO
EqualityHelper behind the scenes in order to determine equality using EMF
dynamic APIs.  The EMF dynamic API is used whether or not the data graphs
are built with dynamic or static data objects.  I can't see an EMF override
of  hashCode() anywhere in the EMF EObject hierarchy that would allow us to
readily preserve the invariant that ...
a.equals(b) => a.hashCode() == b.hashCode()

If we were to create a hashCode() algorithm of our own to match the logic of
the EMF EqualityHelper I guess there's scope for some fragility,  although I
imagine that the EMF EqualityHelper is a pretty stable thing now.

--
Kelvin.



On 11/05/07, Daniel Peter <dp...@yahoo.de> wrote:
>
> Hi all,
>
> I see that the EqualityHelper provides the logic for
> determining the equality of SDOs.
> Is there a way to make the generator produce 'equals'
> and 'hashcode' methods in the generated SDO classes?
>
> Thanks, Daniel.
>
>
>       __________________________________  Kennt man wirklich jeden über 3
> Ecken? Die Antworten gibt's bei Yahoo! Clever. www.yahoo.de/clever
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
>

Re: SDO generator: equals and hashcode

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi,

No there isn't. The SDO spec says this in Section 3.1.12: "A Java 
implementation of DataObject must not override the methods defined in 
java.lang.Object except for toString()."

Frank.

Daniel Peter <dp...@yahoo.de> wrote on 05/11/2007 05:21:23 AM:

> Hi all,
> 
> I see that the EqualityHelper provides the logic for
> determining the equality of SDOs.
> Is there a way to make the generator produce 'equals'
> and 'hashcode' methods in the generated SDO classes?
> 
> Thanks, Daniel.
> 
> 
>       __________________________________  Kennt man wirklich jeden 
> über 3 Ecken? Die Antworten gibt's bei Yahoo! Clever. 
www.yahoo.de/clever
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org