Thanks Mark, 

I didn't know much about the metadata stuff.  This is just what I needed.
With some tweaking and work it's going to make a CFC method where I can feed
it two instances of a CFC and it'll give me the differences between them.

Exactly what I was trying to accomplish!  Well to be more precise it's a lot
more than I was trying to accomplish.

All I was trying to do was compare two UserBeans and identify the
differences.  With your help I can now have a function that is MUCH more
versatile and reusable - I can feed it ANY bean and have it pick out the
differences. 

Thanks!


Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks Pty Ltd
http://afpwebworks.com
Full Scale ColdFusion hosting from A$15/month



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Mark Mandel
Sent: Thursday, 26 October 2006 6:00 PM
To: [email protected]
Subject: Re: [CFCDEV] Easy way to loop over getter methods in a bean?

Something like this will work (totally pseudo) -

<cfset functions = getMetaData(bean).functions />
<cfset len = ArrayLen(function) />

<cfloop from="1" to="#len#" index="counter" >
  <cfset function = functions[counter] />
  <if function.name.startsWith("get") >  <!--- use some handy java --->
     <cfinvoke component="#bean#" method="#function.name#
returbVariable="value1" />
     <cfinvoke component="#bean2#" method="#function.name#
returbVariable="value2" />

     <cfif value1 neq value2 >
             <!--- do stuff here --->
     </cfif>


  </cfif>
</loop>


I take no responsibility for syntactical errors.

Mark





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]

Reply via email to