Say I have an array of values, arbitrary length, that I want to pass
as the arguments to a method.
For example, with this:
positionalArgs = ['foo', 'bar', 42]; // this varies, may be any length
I want to make this call:
SomeComponent.someMethod('foo', 'bar', 42);
Is there a positional equivalent to argumentCollection, or some other
language construct that I don't know about to do this? If the
arguments were in a structure, I could pass it as the
argumentCollection, but I don't know how to do this by position in a
clean way.
Only thing I thought of is a switch statement with some finite number
of cases, each of which calls the method with a specific number of
arguments, like this (partial):
case 2:
SomeComponent.someMethod(positionalArgs[1], positionalArgs[2]);
break;
case 3:
SomeComponent.someMethod(positionalArgs[1], positionalArgs[2],
positionalArgs[3]);
break;
etc...
Any thoughts? Thanks,
Dave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337898
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm