« How to Launch a Small Software Project (RIA Unleashed: Boston 2010) | Main | Real Component Development on the Flex 4 Architecture (RIA Unleashed: Boston 2010) »

Beyond IoC: Advanced Experiments with Swiz (RIA Unleashed: Boston 2010)

Beyond IoC: Advanced Experiments with Swiz by Ben Clinkinbeard

Swiz is all about custom meta-data parsing as returned from describeType(). Recent changes have exposed that meta-data processing to anyone. General switch from autowire to inject.

Swiz is all about defining a list of beans that it knows about. Swiz watches for views to be added and then manages them (i.e. set beans on the view).

In general most of what you can do with a meta-data tag you could also do with an interface, but it isn't as cool.

IProcessor (root of it all)
init() - reference to Swiz instance one is operating in
priority - determine what order processors are run in

IBeanProcessor (extensions) any object that Swiz manages
setUpBean() and tearDownBean()

SwizInterfaceProcessor: checks for common interface types (backwards compatibility)

Bean is wrapper that Swiz puts around your object. It has source property and type descriptors that handles meta-data. Support for class, property, and method meta-data.

IMetadataProcessor (parse custom metadata tags)
metadataNames() - associate with more than one metadata tag
setUpMetadataTags() - metadata tags found and the bean
tearDownMetadataTags()

PostConstruct run after all injections satisfied
MetadataTag allow additional properties like "order"

var f:Function = bean.source[metadataTag.host.name];

Bad things might happen if two register the same meta-data tag. Might be good to add a mapping report to let you know what was injected where.

Unit testing custom meta-data tags is possible.

When an event is dispatched, to check permissions or security constraints, may prevent method from running.

Growing collection of third party custom meta-data processors.

New feature is event chains and command chains. Determine flow by returning AsyncToken or AsynchronousIOOperation.

Tags: as3 flex riaunleashedboston2010 swiz