Re: a unique object representative of an EO?
Re: a unique object representative of an EO?
- Subject: Re: a unique object representative of an EO?
- From: Ramsey Gurley <email@hidden>
- Date: Tue, 21 Jun 2016 09:35:07 -0700
I’m not really clear on what you’re trying to do, so these are some guesses.
You could use the EOSharedEditingContext. You could also play in traffic, but I wouldn’t recommend that either :D Since EOs in the shared ec always are in the shared ec, then they are equals for the same gid. There is, in fact, only one of that EO. However, since the sharedEC is always so problematic, I consider the avoidance of it the eleventh commandment.
One alternative to the shared ec are ERXConstants. Another is Java Enums. I like the enum approach as you can model enums as attributes, and they are guaranteed to be singletons by the language. Your mention of a dictionary also raised the idea of using an ERXMultiKey for whatever you’re doing. Generally, if it’s an EO type thing that needs to be a constant, enums do the trick for me.
On Jun 21, 2016, at 5:51 AM, ocs.cz <email@hidden> wrote:
> Hello there,
>
> I would need an unique object representative of an EO. The object needs to be identical for all EO clones of all editing contexts.
>
> Such a _value_ representation would be the primary key or GID; but these, far as I know, ensure only isEqual for same EO, not ==. I need the identity -- namely, for Java-level locking; the intended usage is something like
>
> ===
> synchronized (representative(eo)) {
> ... this code never runs concurrently for given EO, regardless of its editing context ...
> }
> ===
>
> Is there such an object in EOF, or do I have to create a dictionary keyed by GID or PK? The latter is simple to create, but it is sort of difficult to know when to remove the pair from there.
>
> Thanks,
> OC
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden