| Package | org.springextensions.actionscript.ioc.autowire.impl |
| Class | public class DefaultAutowireProcessor |
| Inheritance | DefaultAutowireProcessor Object |
| Implements | IAutowireProcessor, IObjectFactoryAware, org.as3commons.lang.IApplicationDomainAware, org.as3commons.lang.IDisposable |
Default IAutowireProcessor implementation used by the AbstractObjectFactory.
See also
| Property | Defined By | ||
|---|---|---|---|
| applicationDomain : ApplicationDomain [write-only] | DefaultAutowireProcessor | ||
| autowireMetadataNames : Vector.<String> | DefaultAutowireProcessor | ||
| isDisposed : Boolean [read-only] | DefaultAutowireProcessor | ||
| objectFactory : IObjectFactory | DefaultAutowireProcessor | ||
| Method | Defined By | ||
|---|---|---|---|
DefaultAutowireProcessor(objectFactory:IObjectFactory)
Creates a new DefaultAutowireProcessor instance. | DefaultAutowireProcessor | ||
autoWire(object:Object, objectDefinition:IObjectDefinition = null, objectName:String = null):void
Method called during object creation. | DefaultAutowireProcessor | ||
dispose():void | DefaultAutowireProcessor | ||
findAutowireCandidateName(clazz:Class):String | DefaultAutowireProcessor | ||
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.
| DefaultAutowireProcessor | ||
| Method | Defined By | ||
|---|---|---|---|
assignField(object:Object, field:Field, metadata:Metadata, objectName:String):void | DefaultAutowireProcessor | ||
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 | ||
bindField(object:Object, field:Field, metadata:Metadata, objectName:String):void | DefaultAutowireProcessor | ||
containsObject(objectName:String):Boolean | DefaultAutowireProcessor | ||
determinePrimaryCandidate(candidateNames:Vector.<String>):String | DefaultAutowireProcessor | ||
findAutowireCandidateNames(clazz:Class):Vector.<String>
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 | ||
getAutowireSpecificMetadata(field:Field):Array
Checks if any of the metadata names defined by the autowireMetadataNames are present in the specified Field. | DefaultAutowireProcessor | ||
getBindingUtilsBindPropertyFunction():Function | DefaultAutowireProcessor | ||
getObjectDefinition(objectName:String):IObjectDefinition | DefaultAutowireProcessor | ||
getUnclaimedSimpleObjectProperties(object:Object, objectDefinition:IObjectDefinition):Vector.<Field>
Used by autowire system in order to find fields eligible for autowiring
| DefaultAutowireProcessor | ||
handlePropertyName(object:Object, field:Field, metadata:Metadata, objectName:String):void | DefaultAutowireProcessor | ||
isFactoryObjectForClass(factoryObjectClass:Class, objectName:String, objectClass:Class):Boolean
Returns true if the given factoryObjectClass is a factory object that creates object of the type of objectClass. | DefaultAutowireProcessor | ||
isFieldAutowireRequired(field:Field):Boolean | DefaultAutowireProcessor | ||
isPropertyUnclaimed(objectDefinition:IObjectDefinition, field:Field):Boolean
Determines if a property is unclaimed by an object definition. | DefaultAutowireProcessor | ||
processAutowireAnnotations(objectDefinition:IObjectDefinition, object:Object, objectName:String):void | DefaultAutowireProcessor | ||
setField(object:Object, objectName:String, fieldName:String, objectDefinitionName:String):void | DefaultAutowireProcessor | ||
| Constant | Defined 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 | ||
| AUTOWIRED_PROPERTY_NAME : String = property [static]
Metadata argument key used for bindings, the value of this key determines the host object's property chain. | DefaultAutowireProcessor | ||
| INJECT_ANNOTATION : String = Inject [static]
The name of the metadata that determines whether a field needs to be autowired
| DefaultAutowireProcessor | ||
| TRUE_VALUE : String = true [static]
| DefaultAutowireProcessor | ||
| applicationDomain | property |
applicationDomain:ApplicationDomain [write-only] public function set applicationDomain(value:ApplicationDomain):void| autowireMetadataNames | property |
autowireMetadataNames:Vector.<String> public function get autowireMetadataNames():Vector.<String> public function set autowireMetadataNames(value:Vector.<String>):void| isDisposed | property |
isDisposed:Boolean [read-only] public function get isDisposed():Boolean| objectFactory | property |
objectFactory:IObjectFactory
public function get objectFactory():IObjectFactory public function set objectFactory(value:IObjectFactory):void| DefaultAutowireProcessor | () | Constructor |
public function DefaultAutowireProcessor(objectFactory:IObjectFactory)
Creates a new DefaultAutowireProcessor instance.
objectFactory:IObjectFactory |
| assignField | () | method |
protected function assignField(object:Object, field:Field, metadata:Metadata, objectName:String):void
Parameters
object:Object | |
field:Field | |
metadata:Metadata | |
objectName:String |
| autoWire | () | method |
public function autoWire(object:Object, objectDefinition:IObjectDefinition = null, 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 (default = null) — 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.
|
| autoWireByName | () | method |
protected function autoWireByName(object:Object, objectDefinition:IObjectDefinition):voidCalled by autoWire method in case of autowire by name.
Parameters
object:Object | |
objectDefinition:IObjectDefinition |
| autoWireByType | () | method |
protected function autoWireByType(object:Object, objectDefinition:IObjectDefinition):voidCalled by autoWire method in case of autowire by type.
Parameters
object:Object | |
objectDefinition:IObjectDefinition |
| 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):voidTries 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
|
| bindField | () | method |
protected function bindField(object:Object, field:Field, metadata:Metadata, objectName:String):void
Parameters
object:Object | |
field:Field | |
metadata:Metadata | |
objectName:String |
| containsObject | () | method |
protected function containsObject(objectName:String):BooleanParameters
objectName:String |
Boolean |
| determinePrimaryCandidate | () | method |
protected function determinePrimaryCandidate(candidateNames:Vector.<String>):String
Parameters
candidateNames:Vector.<String> |
String |
| dispose | () | method |
public function dispose():void
| findAutowireCandidateName | () | method |
public function findAutowireCandidateName(clazz:Class):String
Parameters
clazz:Class |
String —
|
| findAutowireCandidateNames | () | method |
protected function findAutowireCandidateNames(clazz:Class):Vector.<String>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.
|
Vector.<String> — an Array containing all autowire candidates names.
|
| getApplicationDomain | () | method |
protected function getApplicationDomain(object:Object):ApplicationDomainReturns the application domain for the given object.
Parameters
object:Object |
ApplicationDomain —
|
| getAutowireSpecificMetadata | () | method |
protected function getAutowireSpecificMetadata(field:Field):Array
Checks if any of the metadata names defined by the autowireMetadataNames are present in the specified Field.
Parameters
field:Field |
Array —
|
| getBindingUtilsBindPropertyFunction | () | method |
protected function getBindingUtilsBindPropertyFunction():FunctionReturns
Function —
|
| getObjectDefinition | () | method |
protected function getObjectDefinition(objectName:String):IObjectDefinition
Parameters
objectName:String |
IObjectDefinition —
|
| getUnclaimedSimpleObjectProperties | () | method |
protected function getUnclaimedSimpleObjectProperties(object:Object, objectDefinition:IObjectDefinition):Vector.<Field>Used by autowire system in order to find fields eligible for autowiring
Parameters
object:Object | |
objectDefinition:IObjectDefinition |
Vector.<Field> — An Array containing the names of all public variables and readwrite / writeonly accessors.
|
| handlePropertyName | () | method |
protected function handlePropertyName(object:Object, field:Field, metadata:Metadata, objectName:String):void
Parameters
object:Object | |
field:Field | |
metadata:Metadata | |
objectName:String |
| isFactoryObjectForClass | () | method |
protected function isFactoryObjectForClass(factoryObjectClass:Class, objectName:String, objectClass:Class):Boolean
Returns true if the given factoryObjectClass is a factory object that creates object of the type of objectClass.
Parameters
factoryObjectClass:Class | |
objectName:String | |
objectClass:Class |
Boolean — True if the given factoryObjectClass is a factory object that creates object of the type of objectClass.
|
| isFieldAutowireRequired | () | method |
protected function isFieldAutowireRequired(field:Field):Boolean
Parameters
field:Field — The field to check for dependency requirement.
|
Boolean — true if autowired field dependency is required, false
otherwise.
|
| isPropertyUnclaimed | () | method |
protected function isPropertyUnclaimed(objectDefinition:IObjectDefinition, field:Field):Boolean
Determines if a property is unclaimed by an object definition. Returns
true, if no object definition is passed, or if the object
definition's properties map does not contain a reference
to the passed in field.
Parameters
objectDefinition:IObjectDefinition — The object definition to inspect.
| |
field:Field — The field to look for on the object definition.
|
Boolean — true if the field is unclaimed.
|
| 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
| processAutowireAnnotations | () | method |
protected function processAutowireAnnotations(objectDefinition:IObjectDefinition, object:Object, objectName:String):void
Parameters
objectDefinition:IObjectDefinition | |
object:Object | |
objectName:String |
| setField | () | method |
protected function setField(object:Object, objectName:String, fieldName:String, objectDefinitionName:String):void
Parameters
object:Object | |
objectName:String | |
fieldName:String | |
objectDefinitionName:String |
| AUTOWIRED_ANNOTATION | Constant |
public static const AUTOWIRED_ANNOTATION:String = AutowiredThe name of the metadata that determines whether a field needs to be autowired
| AUTOWIRED_ARGUMENT_EXTERNALPROPERTY | Constant |
public static const AUTOWIRED_ARGUMENT_EXTERNALPROPERTY:String = externalPropertyThe 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_MODE | Constant |
public static const AUTOWIRED_ARGUMENT_MODE:String = modeThe name of the metadata argument that determines the autowiring strategy, possibles values are 'autodetect', 'byName', 'byType', 'constructor' or 'no'
| AUTOWIRED_ARGUMENT_NAME | Constant |
public static const AUTOWIRED_ARGUMENT_NAME:String = nameThe 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_REQUIRED | Constant |
public static const AUTOWIRED_ARGUMENT_REQUIRED:String = requiredThe name of the metadata argument that determines whether the dependency is required or not.
| AUTOWIRED_PROPERTY_NAME | Constant |
public static const AUTOWIRED_PROPERTY_NAME:String = propertyMetadata argument key used for bindings, the value of this key determines the host object's property chain.
| INJECT_ANNOTATION | Constant |
public static const INJECT_ANNOTATION:String = InjectThe name of the metadata that determines whether a field needs to be autowired
| TRUE_VALUE | Constant |
public static const TRUE_VALUE:String = true