Next Page

1

Previous Page

Thread: BaseComponent

Created on: 12/28/05 01:51 AM

Replies: 3

kbrown


New Member


Joined: 12/28/05

Posts: 1

BaseComponent
12/28/05 1:51 AM

Does the class method work properly for you? I've been working on a core component that other object inherit from, but when you get the metadata using the this reference it is returning data from the core component and not the object inheriting from it. In BaseComponent's case doesn't class always return BaseComponent no matter what the class name is that is inheriting it? Is that what you meant it to do?

Link | Top | Bottom

hal


New Member


Joined: 12/22/05

Posts: 9

RE: BaseComponent
12/28/05 2:12 AM

The class method needs to be changed. Rather than having an instance variable, md, set at object creation, the metadata needs to be evaluated dynamically: <cfreturn getMetadata(this).name

Link | Top | Bottom

seancorfield


New Member


Joined: 12/27/05

Posts: 9

RE: BaseComponent
12/28/05 3:28 AM

I didn't see your original code but if you were attempting to set variables.md in the pseudo-constructor, that might be why you saw this problem. However, getMetadata(this) is very efficient because the metadata is created just once and cached for all instances of the same type (so "caching" the metadata into instance data as you indicated really wouldn't buy you anything).

Link | Top | Bottom

hal


New Member


Joined: 12/22/05

Posts: 9

RE: BaseComponent
12/28/05 3:05 PM

Good to know that. Thanks, Sean.

Link | Top | Bottom

Next Page

1

Previous Page

New Post

Please login to post a response.