Want to know what method you are currently executing, programmatically?
I am recently building a simple mock factory for cf7 (unfortunately I can't use coldmock, no cf8 goodness). One hurdle I was missing, is how to know which method I am currently executing in order to make a return look. Well, or good old friend java to the rescue. This is totally undocumented and please tread with care:
stack = CreateObject("java","java.lang.Exception").init().getStackTrace();
//loop over our stacktrace
for(x=1;x lte ArrayLen(stack);x=x+1){
if( findnocase( getMetdata(this).path, stack[x] ) ){
foundLine = stack[x];
break;
}
}
//cleanup our line
runningFunction = replacenocase(listlast(foundline.getClassName(),"$","func",""));
There you go!! That parses out the inner class name (your method) out of the compiled cf class that coldfusion created for you. I can now do my lookup against it.