Hi Aaron,
If you're talking about a method called getProperty(), of course you could
rename your generic getter to getProperty() and that would work. I'm
assuming you're more talking about a get#PropertyName#() solution so you
could call getFirstName() an getLastName() without actually having to write
such methods.
To my knowledge there is no way you can implement this in ColdFusion as you
are calling methods that don't exist. To be able to do this you would need
some kind of missing method handler capability in CF which would then
effectively take care of this problem.
Only thing I'd say is that to me this is more syntactic sugar than anything
else - the difference betweeen getUserName() and get("UserName") is to me
fairly subtle.
Best Wishes,
Peter
On 5/4/07 10:34 AM, "Aaron Roberson" <[EMAIL PROTECTED]> wrote:
> Sammy,
>
> I didn't think it was possible to use getProperty() on a generic
> getter but as I was searching Google and the various mailing lists I
> came across a conversation between Hal and Sean Corfield. In it, it
> sounded as though Hal was explaining to Sean that his generic gets and
> sets could be accessed that way, but I couldn't view the entire
> conversation (for lack of navigation skills through mailing list
> archives) so I wasn't sure.
>
> -Aaron
>
> On 5/4/07, Sammy Larbi <[EMAIL PROTECTED]> wrote:
>> I haven't taken a look, but my guess would be that it doesn't. In order
>> to use getProperty() rather than get("property") (I'm assuming this is
>> generated dynamically), you would have to write the methods to a file
>> and include it in the class, since there is no way to generate methods
>> dynamically in CF. It's not hard to do by any means, but then you'll
>> want to think about "how do I cache it and reuse it until its changed,
>> so I can limit the # of disk accesses?" (assuming that becomes a
>> problem) and such.
>>
>> I'm still hoping for that functionality /sometime/ =)
>>
>> Sam
>
>
> You are subscribed to cfcdev. To unsubscribe, please follow the instructions
> at http://www.cfczone.org/listserv.cfm
>
> CFCDev is supported by:
> Katapult Media, Inc.
> We are cool code geeks looking for fun projects to rock!
> www.katapultmedia.com
>
> An archive of the CFCDev list is available at
> www.mail-archive.com/[email protected]
>
You are subscribed to cfcdev. To unsubscribe, please follow the instructions at
http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]