Title:
Bug 74146:(Watson Migration Closure)Please add onMethodStart(methodName,methodArgs) and onMethodEnd(methodName,methodArgs) to the CFC specification
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/
Reporter/Name(from Bugbase): Jared Rypka-Hauer / Jared Rypka-Hauer (Jared Rypka-Hauer)
Created: 12/09/2008
Components: Language, CF Component
Versions: 9.0
Failure Type: Unspecified
Found In Build/Fixed In Build: 0000 /
Priority/Frequency: Normal / Unknown
Locale/System: English / Platforms All
Vote Count: 6
Duplicate ID: CF-3687747
Problem:
Please add onMethodStart(methodName,methodArgs) and onMethodEnd(methodName,methodArgs) to the CFC specification. They would work very much like onMissingMethod(), only they would, if implemented in a CFC, fire just before and just after any method call to CFCs.
There may be a minor performance drop but CFC performance once implemented is not a problem. If a user applies them inappropriately, it would be no different than, for example, using lists instead of arrays... you DO have to know what you're doing sometimes.
The ability to trap method calls before and after a method would be invoked would be of IMMEASURABLE benefit to users of CFCs... anything from validation to being able to automatically return a reference to a CFC after calling a setter, with ONE CHANGE TO CODE, is an absolutely fantastic innovation.
The only reason I see this as so important is, well, at this point there is NO OTHER WAY to do this. With this feature, CFCs become even more powerful than they are at this point...
PLEASE!!!!!!!!!!
Method:
<cffunction name="onMethodStart">
<cfargument name="methodName" />
<cfargument name="methodArguments" />
<cfif arguments.methodName IS "setUser">
<cfset local.arg = arguments.methodArguments[1]>
<cfif not isObject(local.arg)
AND getMetaData(arg).name IS "User">
<cfthrow message="you must pass in a User object!" />
</cfif>
</cffunction>
<cffunction name="onMethodEnd">
<cfargument name="methodName" />
<cfargument name="methodArguments" />
<cfif left(arguments.methodName,3) IS "set")>
<cfreturn this />
</cfif>
</cffunction>
Result:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3037006
External Customer Info:
External Company:
External Customer Name: Jared Rypka-Hauer
External Customer Email: 08C411A143BC38A7992016B6
External Test Config: 12/09/2008
Attachments:
Comments: