Packageorg.springextensions.actionscript.ioc.factory.support
Classpublic class AbstractObjectFactory
InheritanceAbstractObjectFactory Inheritance flash.events.EventDispatcher
ImplementsIConfigurableObjectFactory
SubclassesDefaultListableObjectFactory

This is the basic implementation of IConfigurableObjectFactory. Manages object definitions and creates new objects based on those definitions.

See also

org.springextensions.actionscript.ioc.factory.config.IConfigurableObjectFactory


Public Properties
 PropertyDefined by
  numObjectPostProcessors : int
[read-only] Returns the number of object post processors.
AbstractObjectFactory
  typeConverter : ITypeConverter
The current type converter implementation
AbstractObjectFactory
Protected Properties
 PropertyDefined by
  objectDefinitions : Object
The registered object definitions
AbstractObjectFactory
Public Methods
 MethodDefined by
  
Constructs a new AbstractObjectFactory.
AbstractObjectFactory
  
addObjectPostProcessor(objectPostProcessor:IObjectPostProcessor):void
Adds an object postprocessor to this object factory.
AbstractObjectFactory
  
addReferenceResolver(referenceResolver:IReferenceResolver):void
This method adds a reference resolver that will be used to resolve property references.
AbstractObjectFactory
  
clearObjectFromInternalCache(name:String):Object
Removes an object from the internal object definition cache.
AbstractObjectFactory
  
containsObject(objectName:String):Boolean
Determines if the object factory contains a definition with the given name.
AbstractObjectFactory
  
getObject(name:String, constructorArguments:Array = null):*
Will retrieve an object by it's name/id If the definition is a singleton it will be retrieved from cache if possible.
AbstractObjectFactory
  
getType(objectName:String):Class
Returns the type that is defined on the object definition.
AbstractObjectFactory
  
isFactoryObject(objectName:String):Boolean
Determines if an object is a IFactoryObject implementation.
AbstractObjectFactory
  
isPrototype(objectName:String):Boolean
Determines if the definition with the given name is a prototype.
AbstractObjectFactory
  
isSingleton(objectName:String):Boolean
Determines if the definition with the given name is a singleton.
AbstractObjectFactory
  
registerCustomEditor(requiredType:Class, propertyEditor:IPropertyEditor):void
Registers a custom property editor.
AbstractObjectFactory
  
resolveReference(property:Object):Object
Resolves a property in an object definition.
AbstractObjectFactory
Property detail
numObjectPostProcessorsproperty
numObjectPostProcessors:int  [read-only]

Returns the number of object post processors.

Implementation
    public function get numObjectPostProcessors():int
objectDefinitionsproperty 
protected var objectDefinitions:Object

The registered object definitions

typeConverterproperty 
typeConverter:ITypeConverter  [read-write]

The current type converter implementation

Implementation
    public function get typeConverter():ITypeConverter
    public function set typeConverter(value:ITypeConverter):void
Constructor detail
AbstractObjectFactory()constructor
public function AbstractObjectFactory()

Constructs a new AbstractObjectFactory.

The following post processors are added by default:

The following reference resolvers are added by default:

See also

Method detail
addObjectPostProcessor()method
public function addObjectPostProcessor(objectPostProcessor:IObjectPostProcessor):void

Adds an object postprocessor to this object factory.

Parameters
objectPostProcessor:IObjectPostProcessor — the object postprocessor to add
addReferenceResolver()method 
public function addReferenceResolver(referenceResolver:IReferenceResolver):void

This method adds a reference resolver that will be used to resolve property references.

Parameters
referenceResolver:IReferenceResolver — The implementation of IReferenceResolver that should be added
clearObjectFromInternalCache()method 
public function clearObjectFromInternalCache(name:String):Object

Removes an object from the internal object definition cache. This cache is used to cache singletons.

Parameters
name:String — The name/id of the object to remove

Returns
Object — the removed object
containsObject()method 
public function containsObject(objectName:String):Boolean

Determines if the object factory contains a definition with the given name.

Parameters
objectName:String — The name/id of the object definition

Returns
Boolean — true if a definition with that name exists
getObject()method 
public function getObject(name:String, constructorArguments:Array = null):*

Will retrieve an object by it's name/id If the definition is a singleton it will be retrieved from cache if possible. If the definition defines an init method, the init method will be called after all properties have been set.

If any object post processors are defined they will be run against the newly created instance.

The class that is instantiated can implement the following interfaces for a special treatment:

Parameters
name:String — The name of the object as defined in the object definition
 
constructorArguments:Array (default = null) — The arguments that should be passed to the constructor. Note that the constructorArguments can only be passed if the object is defined as lazy.

Returns
* — An instance of the requested object
getType()method 
public function getType(objectName:String):Class

Returns the type that is defined on the object definition.

Parameters
objectName:String — The name/id of the object definition

Returns
Class — the class that is used to construct the object
isFactoryObject()method 
public function isFactoryObject(objectName:String):Boolean

Determines if an object is a IFactoryObject implementation.

Parameters
objectName:String — The name of the object that should be tested

Returns
Boolean — true if the corresponding object is an IFactoryObject implementation
isPrototype()method 
public function isPrototype(objectName:String):Boolean

Determines if the definition with the given name is a prototype.

Parameters
objectName:String — The name/id of the object definition

Returns
Boolean — true if the definitions is defined as a prototype
isSingleton()method 
public function isSingleton(objectName:String):Boolean

Determines if the definition with the given name is a singleton.

Parameters
objectName:String — The name/id of the object definition

Returns
Boolean — true if the definitions is defined as a singleton
registerCustomEditor()method 
public function registerCustomEditor(requiredType:Class, propertyEditor:IPropertyEditor):void

Registers a custom property editor. This method will only have effect if the typeConverter is an implementation of IPropertyEditorRegistry.

Parameters
requiredType:Class — the type of the property
 
propertyEditor:IPropertyEditor — the property editor to register
resolveReference()method 
public function resolveReference(property:Object):Object

Resolves a property in an object definition. If the property could not be resolved, the given property is returned. This means that the property will be checked against all reference resolvers. If a reference resolver can process it, it will do so.

This method is used to resolve implementations of IObjectReference. In order to capture nested references container types like Array and Dictionary are checked as well.

Parameters
property:Object — the property that possibly that might contain references

Returns
Object