Packageorg.springextensions.actionscript.ioc.autowire
SVN browsingDefaultAutowireProcessor.as
FisheyeDefaultAutowireProcessor.as
Classpublic class DefaultAutowireProcessor
ImplementsIAutowireProcessor, IObjectFactoryAware
SubclassesDefaultFlexAutowireProcessor

Default IAutowireProcessor implementation used by the AbstractObjectFactory.

See also

AbstractObjectFactory


Documentation reference: autowiring stage components

Sample project: stagewiring


Public Properties
 PropertyDefined by
  objectFactory : IObjectFactory
DefaultAutowireProcessor
Public Methods
 MethodDefined by
  
Creates a new DefaultAutowireProcessor instance.
DefaultAutowireProcessor
  
autoWire(object:Object, objectDefinition:IObjectDefinition, objectName:String = null):void

Method called during object creation.

DefaultAutowireProcessor
  

Performs AUTODETECT and CONSTRUCTOR checks.

Method that can be invoked by an IObjectFactory implementation for any type of pre-processing of the IObjectDefinition associated with the object that needs to be created.

Typically this method can be used to do some kind of constructor configuration.

DefaultAutowireProcessor
Protected Methods
 MethodDefined by
  
autoWireByName(object:Object, objectDefinition:IObjectDefinition):void
Called by autoWire method in case of autowire by name.
DefaultAutowireProcessor
  
autoWireByType(object:Object, objectDefinition:IObjectDefinition):void
Called by autoWire method in case of autowire by type.
DefaultAutowireProcessor
  
autoWireField(object:Object, field:Field, objectName:String):void
Checks of the specified Field instance contains any autowiring metadata, abd based on this class the appropriate wiring methods.
DefaultAutowireProcessor
  
autoWireFieldByName(object:Object, field:Field, metadata:MetaData, objectName:String):void
Takes the field name or the value of the AUTOWIRED_ARGUMENT_NAME metadata argument, retrieves the object with that name form the objectFactory and injects it into the specified field.
DefaultAutowireProcessor
  
autoWireFieldByPropertyName(object:Object, field:Field, metadata:MetaData, objectName:String):void
Takes the value of the AUTOWIRED_ARGUMENT_EXTERNALPROPERTY metadata argument, looks up the key in the objectFactory's Properties array and injects it into the specified field.
DefaultAutowireProcessor
  
autoWireFieldByType(object:Object, field:Field, metadata:MetaData, objectName:String):void
Tries to retrieve an autowire candidate based on the type of the specified field, and when found injects the candidate into the specified field.
DefaultAutowireProcessor
  
determinePrimaryCandidate(candidateNames:Array):String
DefaultAutowireProcessor
  
findAutowireCandidateName(clazz:Class):String
DefaultAutowireProcessor
  
findAutowireCandidateNames(clazz:Class):Array
Called by autoWireByType to get all object names that could be used to autowire an object property
DefaultAutowireProcessor
  
getApplicationDomain(object:Object):ApplicationDomain
Returns the application domain for the given object.
DefaultAutowireProcessor
  
getUnclaimedSimpleObjectProperties(object:Object, objectDefinition:IObjectDefinition):Array
Used by autowire system in order to find fields eligible for autowire
DefaultAutowireProcessor
Public Constants
 ConstantDefined by
  AUTOWIRED_ANNOTATION : String = "Autowired"
[static] The name of the metadata that determines whether a field needs to be autowired
DefaultAutowireProcessor
  AUTOWIRED_ARGUMENT_EXTERNALPROPERTY : String = "externalProperty"
[static] The name of the metadata argument that determines the name of a property in the container that needs to be injected into the specified field
DefaultAutowireProcessor
  AUTOWIRED_ARGUMENT_MODE : String = "mode"
[static] The name of the metadata argument that determines the autowiring strategy, possibles values are 'autodetect', 'byName', 'byType', 'constructor' or 'no'
DefaultAutowireProcessor
  AUTOWIRED_ARGUMENT_NAME : String = "name"
[static] The name of the metadata argument that determines the name of the object in the container that needs to be injected into the specified field
DefaultAutowireProcessor
  AUTOWIRED_ARGUMENT_REQUIRED : String = "required"
[static] The name of the metadata argument that determines whether the dependency is required or not.
DefaultAutowireProcessor
Property detail
objectFactoryproperty
objectFactory:IObjectFactory  [read-write]

Implementation
    public function get objectFactory():IObjectFactory
    public function set objectFactory(value:IObjectFactory):void
Constructor detail
DefaultAutowireProcessor()constructor
public function DefaultAutowireProcessor(objectFactory:IObjectFactory)

Creates a new DefaultAutowireProcessor instance.

Parameters
objectFactory:IObjectFactory
Method detail
autoWire()method
public function autoWire(object:Object, objectDefinition:IObjectDefinition, objectName:String = null):void

Method called during object creation. Will autowire unclaimed non simple properties by type or by name if required by the object definition.

Performs autowiring on the specified object instance, the specified IObjectDefinition can optionally be used to retrieve autowiring information from. Parameters
object:Object — The instance that needs to be autowired.
 
objectDefinition:IObjectDefinition — The IObjectDefinition associated with the object that needs to be created.
 
objectName:String (default = null) — The name of the object as it is registered in a container.

See also

autoWireByName()method 
protected function autoWireByName(object:Object, objectDefinition:IObjectDefinition):void

Called by autoWire method in case of autowire by name.

Parameters
object:Object
 
objectDefinition:IObjectDefinition

See also

autoWireByType()method 
protected function autoWireByType(object:Object, objectDefinition:IObjectDefinition):void

Called by autoWire method in case of autowire by type.

Parameters
object:Object
 
objectDefinition:IObjectDefinition

See also

autoWireField()method 
protected function autoWireField(object:Object, field:Field, objectName:String):void

Checks of the specified Field instance contains any autowiring metadata, abd based on this class the appropriate wiring methods.

Parameters
object:Object — The object being autowired
 
field:Field — The field that will be examined for the necessary metadata
 
objectName:String — The name of the object in the objectFactory
autoWireFieldByName()method 
protected function autoWireFieldByName(object:Object, field:Field, metadata:MetaData, objectName:String):void

Takes the field name or the value of the AUTOWIRED_ARGUMENT_NAME metadata argument, retrieves the object with that name form the objectFactory and injects it into the specified field.

Parameters
object:Object — The object being autowired
 
field:Field — The field that will be injected
 
metadata:MetaData — The autowiring metadata
 
objectName:String — The name of the object in the objectFactory
autoWireFieldByPropertyName()method 
protected function autoWireFieldByPropertyName(object:Object, field:Field, metadata:MetaData, objectName:String):void

Takes the value of the AUTOWIRED_ARGUMENT_EXTERNALPROPERTY metadata argument, looks up the key in the objectFactory's Properties array and injects it into the specified field.

Parameters
object:Object — The object being autowired
 
field:Field — The field that will be injected
 
metadata:MetaData — The autowiring metadata
 
objectName:String — The name of the object in the objectFactory
autoWireFieldByType()method 
protected function autoWireFieldByType(object:Object, field:Field, metadata:MetaData, objectName:String):void

Tries to retrieve an autowire candidate based on the type of the specified field, and when found injects the candidate into the specified field.

Parameters
object:Object — The object being autowired
 
field:Field — The field that will be injected.
 
metadata:MetaData — The autowiring metadata
 
objectName:String — The name of the object in the objectFactory
determinePrimaryCandidate()method 
protected function determinePrimaryCandidate(candidateNames:Array):String

Parameters
candidateNames:Array

Returns
String
findAutowireCandidateName()method 
protected function findAutowireCandidateName(clazz:Class):String

Parameters
clazz:Class

Returns
String
findAutowireCandidateNames()method 
protected function findAutowireCandidateNames(clazz:Class):Array

Called by autoWireByType to get all object names that could be used to autowire an object property

Parameters
clazz:Class — The class of the property that needs to get autowired.

Returns
Array — an Array containing all autowire candidates names.

See also

getApplicationDomain()method 
protected function getApplicationDomain(object:Object):ApplicationDomain

Returns the application domain for the given object.

Parameters
object:Object

Returns
ApplicationDomain
getUnclaimedSimpleObjectProperties()method 
protected function getUnclaimedSimpleObjectProperties(object:Object, objectDefinition:IObjectDefinition):Array

Used by autowire system in order to find fields eligible for autowire

Parameters
object:Object
 
objectDefinition:IObjectDefinition

Returns
Array — An array containing the names of all public variables and readwrite / writeonly accessors.
preprocessObjectDefinition()method 
public function preprocessObjectDefinition(objectDefinition:IObjectDefinition):void

Performs AUTODETECT and CONSTRUCTOR checks.

Method that can be invoked by an IObjectFactory implementation for any type of pre-processing of the IObjectDefinition associated with the object that needs to be created.

Typically this method can be used to do some kind of constructor configuration.

Parameters
objectDefinition:IObjectDefinition — The IObjectDefinition that describes the object that will be created.

See also

Constant detail
AUTOWIRED_ANNOTATIONconstant
public static const AUTOWIRED_ANNOTATION:String = "Autowired"

The name of the metadata that determines whether a field needs to be autowired

AUTOWIRED_ARGUMENT_EXTERNALPROPERTYconstant 
public static const AUTOWIRED_ARGUMENT_EXTERNALPROPERTY:String = "externalProperty"

The name of the metadata argument that determines the name of a property in the container that needs to be injected into the specified field

AUTOWIRED_ARGUMENT_MODEconstant 
public static const AUTOWIRED_ARGUMENT_MODE:String = "mode"

The name of the metadata argument that determines the autowiring strategy, possibles values are 'autodetect', 'byName', 'byType', 'constructor' or 'no'

AUTOWIRED_ARGUMENT_NAMEconstant 
public static const AUTOWIRED_ARGUMENT_NAME:String = "name"

The name of the metadata argument that determines the name of the object in the container that needs to be injected into the specified field

AUTOWIRED_ARGUMENT_REQUIREDconstant 
public static const AUTOWIRED_ARGUMENT_REQUIRED:String = "required"

The name of the metadata argument that determines whether the dependency is required or not.