tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/3971-multiple-named-argument-via-signal-command-mapRobotlegs: Discussion 2013-07-21T15:23:22Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/278366042013-07-18T13:01:34Z2013-07-18T13:01:34ZMultiple named argument via Signal Command map<div><p>Hello,</p>
<p>I don't know if the new Signal command map for Robotlegs2 has a
solution for your problem, but here it is, in case you haven't seen
it already:</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-extensions-SignalCommandMap">
https://github.com/robotlegs/robotlegs-extensions-SignalCommandMap</a></p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/278366042013-07-18T14:27:40Z2013-07-18T14:27:40ZMultiple named argument via Signal Command map<div><p>We've provided another mechanism: all payload values are
optionally passed to the <code>execute</code> method of the
command.<br>
All you need to do is turn off the automatic injection of payload
values into the command and add method parameters corresponding to
the signalValues to the <code>execute</code> method.</p>
<pre>
<code>//InjectionTestSignal
public function InjectionTestSignal ()
{
super(String, String, IList, IList);
}
//InjectionTestCommand
public function execute(s1:String, s2:String, l1:IList, l2:IList ):void{
//do something crazy!
}
//CommandConfig
signalCommandMap.map(InjectionTestSignal)
.toCommand(InjectionTestCommand)
.withPayloadInjection(false); //don't forget this one</code>
</pre>
<p>You have to set <code>withPayloadInjection</code> to false
otherwise it will error out, since it'll try to map two different
values to the same type (String and IList).</p>
<p>Haven't tested it out, but it should definitely work., if not:
let me know.<br>
TBH, we never had this use case in mind, but we did try to make
everything a bit more versatile; I hope we succeeded (considering
the amount of brain power we put into :) )</p></div>creynderstag:robotlegs.tenderapp.com,2009-10-18:Comment/278366042013-07-19T05:19:09Z2013-07-19T05:19:09ZMultiple named argument via Signal Command map<div><p>Hi creynders</p>
<h2><a href="#it-seem-to-work-but-i-39-ve-to-change-from-" name=
"it-seem-to-work-but-i-39-ve-to-change-from-" class="anchor" id=
"it-seem-to-work-but-i-39-ve-to-change-from-"></a>It seem to work
but i've to change from...</h2>
<h2><a href="#public-class-injectiontestcommand-extends-command-"
name="public-class-injectiontestcommand-extends-command-" class=
"anchor" id=
"public-class-injectiontestcommand-extends-command-"></a>public
class InjectionTestCommand extends Command</h2>
<h2><a href="#to-" name="to-" class="anchor" id="to-"></a>to</h2>
<h2><a href="#public-class-injectiontestcommand-" name=
"public-class-injectiontestcommand-" class="anchor" id=
"public-class-injectiontestcommand-"></a>public class
InjectionTestCommand</h2>
<h2><a href="#so-i-can-freely-do-" name="so-i-can-freely-do-"
class="anchor" id="so-i-can-freely-do-"></a>so i can freely do</h2>
<h2><a href=
"#public-function-execute-s1-string-s2-string-l1-ilist-l2-ilist-void-"
name=
"public-function-execute-s1-string-s2-string-l1-ilist-l2-ilist-void-"
class="anchor" id=
"public-function-execute-s1-string-s2-string-l1-ilist-l2-ilist-void-">
</a>public function execute(s1:String, s2:String, l1:IList,
l2:IList ):void{....}</h2>
<p>then I just realized that i didn't need to "extends Command" am
i right?</p>
<p>because it just working(yeah!), but i didn't know what gonna
break if i didn't extend Command...</p>
<p>Thanks</p></div>katopztag:robotlegs.tenderapp.com,2009-10-18:Comment/278366042013-07-21T15:23:21Z2013-07-21T15:23:21ZMultiple named argument via Signal Command map<div><blockquote>
<p>then I just realized that i didn't need to "extends Command" am
i right?</p>
</blockquote>
<p>You don't have to extend <code>Command</code> it is just a
convenience class. And, in this case it is not very convenient, so
you don't need to use it :)</p></div>Shaun Smith