The UUID mechanism works well, as long as the implicit superclass is
where the method is defined, rather than in some explicit superclass. 
That'd be Java's java.lang.Object, and CF's web-inf.cftags.component. 
Just throw your method in there, and every CFC on your server will
magically have the method.

cheers,
barneyb

On 10/18/05, Mark Mandel <[EMAIL PROTECTED]> wrote:
> Thanks for the input everyone:
>
> Nando - Why am I doing this?
>
> I have a couple of place where I need it - but at the moment it's
> primarily for managing a Observer/Observable pattern.
>
> Because Observer can be any object (that implements a standard
> method), when you go to remove a Observer from an Observable object,
> you need to be able to compare 2 CFC instances to see if they are the
> same Objects and you can therefore remove it.  Hence the need for an
> .equals or equivelent.
>
> The idea for a BaseComponent to create UUID -
> I think this is bad for 2 reasons
> (1) you now have very stong coupling over a inheritence structure
> (2) This Event structure is meant to be able to handle any CFC that is
> passed in a defines the given method, that includes CFCs not written
> by me.  Having a generic base CFC severly limits that.
>
> A much more interesting, and far less coupled approach to doing this
> (and I would probably do it if the hashCode way wasn't working) was
> actually to assign UUID to the Object via a Mixin when it was added as
> an Observable, along with appropriate getUUID() and isEquals()
> methods.
>
> When then checking to see if two objects where equal, first it would
> check to make sure the getUUID() exists (if not, it's not equal) and
> then compare the values.
>
> Finally, Patrick - checked the URL
> http://pmcelhaney.weblogs.us/archives/22
>
> It gives me a connection refused error... is that the right URL?
>
> Thanks!
>
> Mark

--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 100 invites.

Reply via email to