Getting List of method name in handlers

24 views
Skip to first unread message

murphyhg

unread,
May 30, 2012, 11:15:14 PM5/30/12
to ColdBox Platform
Hi Guys, what code would I need to get a list of the methods in a
handler?
Thanks

Luis Majano

unread,
May 31, 2012, 12:13:04 AM5/31/12
to col...@googlegroups.com
from where?
--
You received this message because you are subscribed to the Google Groups "ColdBox Platform" group.
To post to this group, send email to col...@googlegroups.com
To unsubscribe from this group, send email to coldbox-u...@googlegroups.com
For more options, visit this group at http://groups-beta.google.com/group/coldbox
For News, visit http://blog.coldbox.org
For Documentation, visit http://wiki.coldbox.org

phill.nacelli

unread,
May 31, 2012, 3:51:32 PM5/31/12
to col...@googlegroups.com
George, it depends where do you want to call this from? 

if within the handler itself just do:

var handlerMetadata = getMetadata(this);

or, if outside the handler and the handler path is known:

var handlerMetadata = getComponentMetadata("path.to.handlers.myHandler");

then extract all the methods by referencing the ".functions" property in the returned metadata:

 // all the methods
dump(handlerMetadata.functions);
 

Jason Durham

unread,
May 31, 2012, 3:58:47 PM5/31/12
to col...@googlegroups.com
Would a third option be to call getMetadata() on the handler instance
in the cache?

Jason Durham

Don Q

unread,
May 31, 2012, 9:38:53 PM5/31/12
to ColdBox Platform
I don't remember if I found this, did it myself, or was a combination
of both, so give credit where credit is due if you recognize it.

This function is in one of my handlers and is called after a fwreinit
is sent. It will search all the event handlers registered with the cb
application and extract the handler.event paths and load them into the
security rule model for processing

https://gist.github.com/2847936

Reply all
Reply to author
Forward
0 new messages