| Package | org.springextensions.actionscript.context.support |
| SVN browsing | MXMLApplicationContext.as |
| Fisheye | MXMLApplicationContext.as |
| Class | public class MXMLApplicationContext |
| Inheritance | MXMLApplicationContext AbstractApplicationContext DefaultListableObjectFactory AbstractObjectFactory flash.events.EventDispatcher |
| Implements | mx.core.IMXMLObject |
Configurations are defined in one or more MXML files. Each MXML config that needs to be loaded, should be added to an MXMLApplicationContext instance via the addConfig() method. Once all configurations are added, invoking the load() method will (asynchronously) load and initialize the application context.
Objects can either be defined explicitly (e.g. <mx:RemoteObject/>) or implicitly via a object definition.
The MXMLApplicationContext also allows property placeholders (that resolve externally loaded properties) inside both explicit and implicit object definitions.
<Objects
xmlns="http://www.springactionscript.org/mxml/config"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:context="org.springextensions.actionscript.ioc.factory.config.>
<mx:Script>
import mx.rpc.remoting.mxml.RemoteObject;
</mx:Script>
<context:PropertyPlaceholderConfigurer locations="{['properties.properties.txt', 'server.properties.txt']}"/>
<Object id="string1" clazz="{String}">
<ConstructorArg>$(property1)</ConstructorArg>
</Object>
<mx:Array id="propertiesArray">
<mx:String>$(property1)</mx:String>
<mx:String>$(property2)</mx:String>
<mx:String>$(property3)</mx:String>
</mx:Array>
<mx:RemoteObject endpoint="http://$(host):$(port)/$(context-root)/messagebroker/amf"/>
<mx:RemoteObject id="remoteObject1" endpoint="http://$(host):$(port)/$(context-root)/messagebroker/amf"/>
<mx:RemoteObject id="remoteObject2">
<mx:endpoint>http://$(host):$(port)/$(context-root)/messagebroker/amf</mx:endpoint>
</mx:RemoteObject>
<Object id="remoteObjectDefinitionWithPlaceHolders" clazz="{RemoteObject}">
<Property name="endpoint" value="http://$(host):$(port)/$(context-root)/messagebroker/amf"/>
</Object>
</Objects>
Documentation reference: composing mxml based configuration metadata
| Method | Defined by | ||
|---|---|---|---|
|
MXMLApplicationContext(config:* = null)
Creates a new
MXMLApplicationContext instance. | MXMLApplicationContext | ||
|
addConfig(configClass:Class):void
Adds a single MXML configuration Class object to the application context.
| MXMLApplicationContext | ||
![]() |
addObjectFactoryPostProcessor(objectFactoryPostProcessor:IObjectFactoryPostProcessor, index:int = -1):void
Adds an
IObjectFactoryPostProcessor instance to the current XMLApplicationContext
| AbstractApplicationContext | |
![]() |
addObjectPostProcessor(objectPostProcessor:IObjectPostProcessor):void
If the specified | AbstractObjectFactory | |
![]() |
addReferenceResolver(referenceResolver:IReferenceResolver):void
This method adds a reference resolver that will be used to resolve property
references.
| AbstractObjectFactory | |
![]() |
canCreate(objectName:String):Boolean
Determines if the object factory is able to create the object with the given name.
| 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 | |
![]() |
containsObjectDefinition(objectName:String):Boolean
Determines if an object definition with the given name exists
| DefaultListableObjectFactory | |
![]() |
createInstance(clazz:Class, constructorArguments:Array = null):*
Creates an instance of the specified
Class, wires the instance and returns it. | AbstractObjectFactory | |
![]() |
getClassForInstance(object:Object):Class
| AbstractObjectFactory | |
![]() |
getClassForName(className:String):Class
| 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 | |
![]() |
getObjectDefinition(objectName:String):IObjectDefinition
Returns the object definition registered with the given name.
| DefaultListableObjectFactory | |
![]() |
getObjectNamesForType(type:Class):Array
Returns the names of all object definitions and explicit singletons in this factory that are of
the given type.
| DefaultListableObjectFactory | |
![]() |
getObjectsOfType(type:Class):Object
Returns all object definitions and explicit singletons that are of the given type.
| DefaultListableObjectFactory | |
![]() |
getType(objectName:String):Class
Returns the type that is defined on the object definition.
| AbstractObjectFactory | |
|
initialized(document:Object, id:String):void
Checks if the | MXMLApplicationContext | ||
![]() |
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 | |
|
load():void
Loads the application context.
| MXMLApplicationContext | ||
![]() |
preInstantiateSingletons():void
Checks if the objectdefinition is an implementation of | DefaultListableObjectFactory | |
![]() |
registerCustomEditor(requiredType:Class, propertyEditor:IPropertyEditor):void
Registers a custom property editor.
| AbstractObjectFactory | |
![]() |
registerObjectDefinition(objectName:String, objectDefinition:IObjectDefinition):void
Registers the given objectDefinition under the given name.
| DefaultListableObjectFactory | |
![]() |
registerSingleton(name:String, object:Object):void
| AbstractApplicationContext | |
![]() |
removeObjectDefinition(objectName:String):void
Removes the definition with the given name from the registry
| DefaultListableObjectFactory | |
![]() |
resolveReference(property:Object):Object
Resolves a property in an object definition.
| AbstractObjectFactory | |
![]() |
wire(object:*, objectDefinition:IObjectDefinition, objectName:String = null):void
| AbstractObjectFactory | |
| Method | Defined by | ||
|---|---|---|---|
![]() |
buildObject(name:String, constructorArguments:Array = null):*
Builds an object for the given name and returns it.
| AbstractObjectFactory | |
![]() |
createObjectViaInstanceFactoryMethod(objectName:String, methodName:String, args:Array = null):*
| AbstractObjectFactory | |
![]() |
createObjectViaStaticFactoryMethod(clazz:Class, applicationDomain:ApplicationDomain, factoryMethodName:String, args:Array = null):*
| AbstractObjectFactory | |
|
getParentDocument(object:Object):Module
| MXMLApplicationContext | ||
![]() |
Invokes all object factory post processors.
| AbstractApplicationContext | |
![]() |
loadComplete():void
TODO
| AbstractApplicationContext | |
![]() |
prepareApplicationContext():void
Hook method defined in XmlObjectFactory to add the
ApplicationContextAwareProcessor. | AbstractApplicationContext | |
![]() |
Looks for implementations of IObjectFactoryPostProcessor in the object definition of this context and
add an instance of each one as a object factory post processor.
| AbstractApplicationContext | |
![]() |
registerObjectPostProcessors():void
Will search all object definitions for implementations of IObjectPostProcessor.
| AbstractApplicationContext | |
| MXMLApplicationContext | () | constructor |
public function MXMLApplicationContext(config:* = null)
Creates a new MXMLApplicationContext instance.
This constructor will accept a Class object representing the MXML configuration or an Array representing multiple MXML configuration Class objects.
Parametersconfig:* (default = null) — a Class object or an Array of Class objects representing MXML configurations
|
| addConfig | () | method |
public function addConfig(configClass:Class):voidAdds a single MXML configuration Class object to the application context. If the configuration class was already added, it will be ignored.
ParametersconfigClass:Class — the Class object representing an MXML configuration
|
| getParentDocument | () | method |
protected function getParentDocument(object:Object):ModuleParameters
object:Object |
Module |
| initialized | () | method |
public function initialized(document:Object, id:String):void
Checks if the document parameter is of type Module and if so sets it as the ownerModule property.
document:Object |
|
id:String |
See also
| load | () | method |
public override function load():voidLoads the application context.