cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Re: ObjectContext.localObject refactoring
Date Sun, 04 Sep 2011 00:03:19 GMT
Just the other day I started to try to explain this to a co-worker and
essentially told them "don't question it, just use it."  That's
probably not the best answer.

I'm still not sure I like the method name localObject().  I think it
should be clear to the user that it takes an existing object (not a
new one) in one context and makes a copy of it to be also managed by a
different context.  We need to keep localObject() around for a bit,
though, for backward compatibility.

Throwing some naming ideas out:

add(object)
manage(object)
register(object)
registerExistingObject(object) -- would be similar to registerNewObject(object)

In short, though, I agree this API should die.  :-)

mrg


On Sat, Sep 3, 2011 at 5:16 PM, Andrus Adamchik <andrus@objectstyle.org> wrote:
> https://issues.apache.org/jira/browse/CAY-1611
>
> I've got tired of doing:
>
> Artist localArtist = (Artist) context.localArtist(artist.getObjectId(), null);
>
> Aside from causing confusion about the second argument (should it be 'artist'? no, it
should be null), it is still plain ugly. Anyone sees any flaws with the reasoning behind this
Jira?
>
> Andrus

Mime
View raw message