Re: Converting from one subclass to another
Re: Converting from one subclass to another
- Subject: Re: Converting from one subclass to another
- From: Thomas <email@hidden>
- Date: Thu, 14 Feb 2008 08:51:29 +1100
Why not just have one class, have a flag in that class that says
whether it is calculated or stored, and have a cover method that
returns the calculated or stored value depending on the value of that
flag? You can then change the flag as often as you like without having
to create new objects.
Keep it simple...
Regards
Thomas
On 14/02/2008, at 7:51 AM, Mike Schrag wrote:
The problem I'm having is that I'm somehow getting two instances of
the target subclass. Maybe someone can look at this code and tell
me what I'm doing wrong.
It's a big red flag to be deleting and "replacing" yourself inside
your own set method ... This is going to really cause weird problems
if someone is bound to the original object (it would have no way of
knowing that it's supposed to be replaced). This should really be
done a layer above this object by the thing that keeps a reference
to it, it seems to me. As far as the double creation, you can also
add Thread.dumpStack()'s in this method or add a breakpoint and see
when it's getting called twice. It's also a red flag that you're
comparing objects with != ... It's an EO and probably actually true
here, but smells in general. That should really be a .equals(..)
(which a null check).
_______________________________________________
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