Issue when mediating Object event properties

1 view
Skip to first unread message

Andrew Westberg

unread,
Nov 19, 2009, 4:26:00 PM11/19/09
to Swiz Framework
In my mediator, I'm trying to pass along a property that's type
Object. Inside the mediator, instead of the raw Object, I get a copy
of the event itself. Any idea what's going on?

[Mediate(event="WorkstationStatusEvent.WORKSTATION_STATUS_UPDATED",
property="workstationInfo")]
public function handleWorkstationStatusUpdates
(workstationInfo:Object):void
{
//in here, workstationInfo is of type WorkstationStatusEvent instead
of the workstationInfo Object property ON the event
}

-Andrew

Brian Kotek

unread,
Nov 19, 2009, 4:33:31 PM11/19/09
to swiz-fr...@googlegroups.com
First, I would remove the property from the metadata and add a breakpoint at the top of the event handler to confirm that the property is there and is what you expect it to be at the time the handler is invoked. You can also try removing the mediator metadata and adding an explicit event listener on the Swiz central dispatcher for this event, and then debug in the handler to check it that way as well.


--

You received this message because you are subscribed to the Google Groups "Swiz Framework" group.
To post to this group, send email to swiz-fr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/swiz-framework?hl=.



odoe

unread,
Nov 19, 2009, 4:39:07 PM11/19/09
to Swiz Framework
How about if you change property to properties?
[Mediate(event="eventName", properties="propertiesName")]

It matters when I switch it in my application.

Andrew Westberg

unread,
Nov 19, 2009, 4:44:31 PM11/19/09
to swiz-fr...@googlegroups.com
doh!

Andrew Westberg

unread,
Nov 19, 2009, 4:45:55 PM11/19/09
to swiz-fr...@googlegroups.com
I guess it's a bit confusing when on [Autowire] you have "property", but on [Mediate] you have "properties".  Maybe [Mediate] should look for "property" if "properties" doesn't exist.

Brian Kotek

unread,
Nov 19, 2009, 5:00:31 PM11/19/09
to swiz-fr...@googlegroups.com
Well, property on Autowire is to inject a single property. Properties on Mediate is to supply any number of event properties to the handler method. So while it means you do have to be careful, they both are named about the only way they can be. Adding another possible value to Mediate that is almost exactly the same as the existing one ("properties") wouldn't be a good idea and opens up all sorts of fun issues. What happens if both "property" and "properties" are defined being the first one that leaps out.

Brian

Sam Ahn

unread,
Nov 19, 2009, 5:06:03 PM11/19/09
to swiz-fr...@googlegroups.com
How about logging warnings for unrecognized metadata properties?
http://blog.foomonger.com/
http://twitter.com/foomonger/
Reply all
Reply to author
Forward
0 new messages