christophe-hall / as3-commons

Automatically exported from code.google.com/p/as3-commons
0 stars 0 forks source link

setter accessor not invoked when using MethodInvokers.ivoke #16

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When setter and getter accessors exist on an object using the
MethodInvokers invoke method only invokes the get accessor when passing
parameters to the method. example
class Person
{
  var m_email:String;
  public function get email() "String
  {...}

  public function set email( email:String ) : void
  { m_email = email; }
}

code example:
var objPerson:Person = new Person();

var params:Array = new Array();
params.push( "foo@gmail.com" );
var m:MethodInvoker = new MethodInvoker();
m.target = objPerson;
m.method = "email";
m.arguments = params;
var returnValue:* = m.invoke();

I would expect the setter methodto be called because
the params is passed and it matches the method signature of the set email
function but the get method is called. Is there a different syntax required
here to invoke the setter?
I am using the as3commons-reflect-1.0.0 swc for this example.

Original issue reported on code.google.com by pvos...@gmail.com on 5 Feb 2010 at 1:51

GoogleCodeExporter commented 8 years ago
In this case using a MethodInvoker to set a property seems a bit awkward, no? 
The
easiest way to set the property here would just to use objPerson.email = 
"foo@gmail.com".
Can you state a valid use case where calling the setter function would be 
desirable?

Original comment by ihatelivelyids on 21 Mar 2010 at 2:51

GoogleCodeExporter commented 8 years ago

Original comment by ihatelivelyids on 10 Nov 2010 at 9:14