Skip to content

Instantly share code, notes, and snippets.

@bclinkinbeard
Created March 18, 2010 01:09
Show Gist options
  • Save bclinkinbeard/335934 to your computer and use it in GitHub Desktop.
Save bclinkinbeard/335934 to your computer and use it in GitHub Desktop.
package
{
import org.swizframework.core.Bean;
import org.swizframework.metadata.InjectMetadataTag;
import org.swizframework.processors.IMetadataProcessor;
import org.swizframework.processors.InjectProcessor;
import org.swizframework.reflection.MetadataHostMethod;
public class InjectNSProcessor extends InjectProcessor implements IMetadataProcessor
{
public function InjectNSProcessor()
{
// this processor is interested in InjectNS tags
super( [ "InjectNS" ] );
}
override protected function setDestinationValue( injectTag:InjectMetadataTag, bean:Bean, value:* ):void
{
var setterInjection:Boolean = injectTag.host is MetadataHostMethod;
var destObject:Object = getDestinationObject( injectTag, bean );
var destPropName:String = getDestinationPropertyName( injectTag );
// get qualified name of the destnation using custom namespace
var qn:QName = new QName( injection_namespace, destPropName );
if( setterInjection )
{
var f:Function = destObject[ qn ] as Function;
f.apply( destObject, [ value ] );
}
else
{
destObject[ qn ] = value;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment