|
This is one of the features my libraries: http://www.depressedpress.com/Content/Development/ColdFusion/DPLibraries/Index.cfm If you extend the root component you’ll
get metadata caching which (at least so far) has scaled pretty well. The
root component documentation is here: The method cacheDPMetaData() caches method
and property information along with ancestry and other information – it stores
the information in the application (if available) or server scope for later
reference. The documentation I referenced has all the
code used – feel free to either use it or take from it (it’s all
under the BSD license). Jim Davis From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Bell I thought it might be nice to have a list of valid method
names when initiating an object so I'd be able to make sure I didn't try to run
a method (perhaps based on user input) that was inappropriate. Of course, I
could use try/catch but that wouldn't distinguish between calling invalid
methods and errors within the method. Anyhow, getMetaData() works fine, but I ran into problems
getting a clean method list: <cfset Local.TempMetaData =
getMetaData(THIS)> Successfully returns the name of the first method of the
object. Trying to loop through them as below gives "Invalid
collection "[Ljava.lang.Object;@1f4c4a3" - must be a valid struct or
COM object. " <cfloop collection="#Local.FunctionList#"
item="Count"> I have a feeling this is a simple syntax problem but am not
sure . . . Anyone have simple code for returning a list of methods? FYI, I know Sean suggested some time back that run time
introspection doesn't scale, but by only running this routine on a small number
of objects that I persist throughout an application and by only calling it once
on object creation I'm betting the performance overhead will be minimal. Best Wishes, You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected] |
Title: Message
- [CFCDev] Using Introspection of methods on Init? Peter Bell
- Re: [CFCDev] Using Introspection of methods on Init? Shib71
- RE: [CFCDev] Using Introspection of methods on Init? Jim Davis
