Not the most elegant, but you can rock a try/catch:
<cftry>
<cfset lstFields = myobjext.getExtendedFields() />
<cfcatch>
<cfset lstFields = "" />
</cfcatch>
</cftry>
Other than that, you can probably try some sort of reflection (using all
the Java reflection stuff) but that is probably way overkill/??
......................
Ben Nadel
Certified Advanced ColdFusion MX7 Developer
www.bennadel.com
Need ColdFusion Help?
www.bennadel.com/ask-ben/
-----Original Message-----
From: Russ Michaels [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 15, 2007 7:57 AM
To: CF-Talk
Subject: test if method exists
I am working with a JAVA web service, and I get back an array of objects
with methods to access the data.
One of these methods is getExtendedFields() which will only exist if
there are any extended fields. So I need to be able to test if this
method actually exists before I bother trying to access its methods.
I thought I could do a structkeyexists, but that doesn't work <cfif
StructkeyExists(myobjext,'getExtendedFields')>
anything else I can do ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:269882
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4