Packageorg.springextensions.actionscript.ioc.factory.xml.parser.support
SVN browsingXMLObjectDefinitionsParser.as
FisheyeXMLObjectDefinitionsParser.as
Classpublic class XMLObjectDefinitionsParser
SubclassesFlexXMLObjectDefinitionsParser

Xml parser for object definitions.



Public Properties
 PropertyDefined by
  applicationContext : IApplicationContext
The objectFactory currently in use
XMLObjectDefinitionsParser
  nodeParsers : Array
[read-only] Returns all registered implementations of INodeParser.
XMLObjectDefinitionsParser
Public Methods
 MethodDefined by
  
Constructs a new XmlObjectDefinitionsParser.
XMLObjectDefinitionsParser
  
Adds a namespace handler.
XMLObjectDefinitionsParser
  
Adds a NodeParser to the parser.
XMLObjectDefinitionsParser
  
Adds a preprocessor to the parser.
XMLObjectDefinitionsParser
  
Generates an object name for the given object definition.
XMLObjectDefinitionsParser
  
Parses all object definitions and returns the objectFactory that contains the parsed results.
XMLObjectDefinitionsParser
  
Parses and registers an object definition.
XMLObjectDefinitionsParser
  
parseNode(node:XML):void
XMLObjectDefinitionsParser
  
parseObjectDefinition(xml:XML, objectDefinition:IObjectDefinition = null):IObjectDefinition
Parses the given object definition node into an implementation of IObjectDefinition.
XMLObjectDefinitionsParser
  
parseProperty(node:XML):Object
Will parse the given property node.
XMLObjectDefinitionsParser
  
parsePropertyValue(node:XML):Object
Will parse the given property value using the node parsers.
XMLObjectDefinitionsParser
  
registerObjectDefinition(objectName:String, objectDefinition:IObjectDefinition):void
Registers an object definition in the internal object factory.
XMLObjectDefinitionsParser
Protected Methods
 MethodDefined by
  
isDefaultNamespace(qname:QName):Boolean
XMLObjectDefinitionsParser
  
parseAttributes(objectDefinition:IObjectDefinition, xml:XML):void
Parses the attributes of an object node into an object definition.
XMLObjectDefinitionsParser
  
parseConstructorArguments(objectDefinition:IObjectDefinition, xml:XML):void
Will retrieve the constructor arguments and parses them as if they were property nodes.
XMLObjectDefinitionsParser
  
parseCustomNode(node:XML):void
XMLObjectDefinitionsParser
  
parseDefaultNode(node:XML):void
XMLObjectDefinitionsParser
  
XMLObjectDefinitionsParser
  
parseMethodInvocations(objectDefinition:IObjectDefinition, xml:XML):void
Parses the method invocations of the given definition.
XMLObjectDefinitionsParser
  
parseObjectDefinitions(xml:XML):void
XMLObjectDefinitionsParser
  
parseProperties(objectDefinition:IObjectDefinition, xml:XML):void
Parses the properties of the given definition.
XMLObjectDefinitionsParser
  
preProcessXML(xml:XML):void
Pre process the xml data before parsing.
XMLObjectDefinitionsParser
  
processObjectDefinition(node:XML):void
Process the given node as an object definition.
XMLObjectDefinitionsParser
Public Constants
 ConstantDefined by
  ABSTRACT_ATTRIBUTE : String = "abstract"
[static]
XMLObjectDefinitionsParser
  ARRAY_COLLECTION_ELEMENT : String = "array-collection"
[static] Constant value 'array-collection'
XMLObjectDefinitionsParser
  ARRAY_ELEMENT : String = "array"
[static] Constant value 'array'
XMLObjectDefinitionsParser
  AUTOWIRE_CANDIDATE_ATTRIBUTE : String = "autowire-candidate"
[static]
XMLObjectDefinitionsParser
  AUTOWIRE_MODE_ATTRIBUTE : String = "autowire"
[static]
XMLObjectDefinitionsParser
  AUTOWIRE_PRIMARY_CANDIDATE_ATTRIBUTE : String = "primary"
[static]
XMLObjectDefinitionsParser
  CLASS_ATTRIBUTE : String = "class"
[static]
XMLObjectDefinitionsParser
  CONSTRUCTOR_ARG_ELEMENT : String = "constructor-arg"
[static] Constant value 'constructor-arg'
XMLObjectDefinitionsParser
  DEPENDENCY_CHECK_ATTRIBUTE : String = "dependency-check"
[static]
XMLObjectDefinitionsParser
  DEPENDS_ON_ATTRIBUTE : String = "depends-on"
[static]
XMLObjectDefinitionsParser
  DESTROY_METHOD_ATTRIBUTE : String = "destroy-method"
[static]
XMLObjectDefinitionsParser
  DICTIONARY_ELEMENT : String = "dictionary"
[static] Constant value 'dictionary'
XMLObjectDefinitionsParser
  ENTRY_ELEMENENT : String = "entry"
[static] Constant value 'entry'
XMLObjectDefinitionsParser
  FACTORY_METHOD_ATTRIBUTE : String = "factory-method"
[static]
XMLObjectDefinitionsParser
  FACTORY_OBJECT_ATTRIBUTE : String = "factory-object"
[static]
XMLObjectDefinitionsParser
  ID_ATTRIBUTE : String = "id"
[static]
XMLObjectDefinitionsParser
  INIT_METHOD_ATTRIBUTE : String = "init-method"
[static]
XMLObjectDefinitionsParser
  KEY_ATTRIBUTE : String = "key"
[static]
XMLObjectDefinitionsParser
  KEY_ELEMENT : String = "key"
[static] Constant value 'key'
XMLObjectDefinitionsParser
  LAZY_INIT_ATTRIBUTE : String = "lazy-init"
[static]
XMLObjectDefinitionsParser
  LIST_ELEMENT : String = "list"
[static] Constant value 'list'
XMLObjectDefinitionsParser
  MAP_ELEMENT : String = "map"
[static] Constant value 'map'
XMLObjectDefinitionsParser
  METHOD_INVOCATION : String = "method-invocation"
[static] Constant value 'method-invocation'
XMLObjectDefinitionsParser
  NULL_ELEMENT : String = "null"
[static] Constant value 'null'
XMLObjectDefinitionsParser
  OBJECT_ELEMENT : String = "object"
[static] Constant value 'object'
XMLObjectDefinitionsParser
  OBJECT_NAME_DELIMITERS : String = ",; "
[static]
XMLObjectDefinitionsParser
  PROPERTY_ELEMENT : String = "property"
[static] Constant value 'property'
XMLObjectDefinitionsParser
  REF_ATTRIBUTE : String = "ref"
[static]
XMLObjectDefinitionsParser
  REF_ELEMENT : String = "ref"
[static] Constant value 'ref'
XMLObjectDefinitionsParser
  SCOPE_ATTRIBUTE : String = "scope"
[static]
XMLObjectDefinitionsParser
  SKIP_METADATA : String = "skip-metadata"
[static] Constant value 'method-invocation'
XMLObjectDefinitionsParser
  SKIP_POSTPROCESSORS : String = "skip-postprocessors"
[static] Constant value 'skip-postprocessors'
XMLObjectDefinitionsParser
  TEMPLATE_ELEMENT : String = "template"
[static] Constant value 'template'
XMLObjectDefinitionsParser
  VALUE_ATTRIBUTE : String = "value"
[static]
XMLObjectDefinitionsParser
  VALUE_ELEMENT : String = "value"
[static] Constant value 'value'
XMLObjectDefinitionsParser
  VECTOR_ELEMENT : String = "vector"
[static] Constant value 'vector'
XMLObjectDefinitionsParser
Property detail
applicationContextproperty
applicationContext:IApplicationContext  [read-write]

The objectFactory currently in use

The default value is an instance of XMLObjectFactory.

Implementation
    public function get applicationContext():IApplicationContext
    public function set applicationContext(value:IApplicationContext):void

See also

org.springextensions.actionscript.ioc.factory.xml.XMLObjectFactory
nodeParsersproperty 
nodeParsers:Array  [read-only]

Returns all registered implementations of INodeParser. Node parsers can be added using the addNodeParser method.

Implementation
    public function get nodeParsers():Array

See also

Constructor detail
XMLObjectDefinitionsParser()constructor
public function XMLObjectDefinitionsParser(applicationContext:IApplicationContext = null)

Constructs a new XmlObjectDefinitionsParser. An optional objectFactory can be passed to store the definitions. If no container is passed then a new instance will be created of type XMLObjectFactory.

Parameters
applicationContext:IApplicationContext (default = null) — the objectFactory where the object definitions will be stored

See also

Method detail
addNamespaceHandler()method
public function addNamespaceHandler(handler:INamespaceHandler):void

Adds a namespace handler.

Parameters
handler:INamespaceHandler
addNodeParser()method 
public function addNodeParser(parser:INodeParser):void

Adds a NodeParser to the parser.

Parameters
parser:INodeParser — The implementation of INodeParser that will be added
addPreprocessor()method 
public function addPreprocessor(preprocessor:IXMLObjectDefinitionsPreprocessor):void

Adds a preprocessor to the parser.

Parameters
preprocessor:IXMLObjectDefinitionsPreprocessor — The implementation of IXMLObjectDefinitionsPreprocessor that will be added
generateObjectName()method 
public function generateObjectName(definition:IObjectDefinition):String

Generates an object name for the given object definition.

Parameters
definition:IObjectDefinition

Returns
String
isDefaultNamespace()method 
protected function isDefaultNamespace(qname:QName):Boolean

Parameters
qname:QName

Returns
Boolean
parse()method 
public function parse(xml:XML):IApplicationContext

Parses all object definitions and returns the objectFactory that contains the parsed results.

Parameters
xml:XML — the xml object with the object definitions

Returns
IApplicationContext — the objectFactory with the parsed object definitions
parseAndRegisterObjectDefinition()method 
public function parseAndRegisterObjectDefinition(node:XML):String

Parses and registers an object definition.

Parameters
node:XML — The xml node to create an object definition from.

Returns
String
parseAttributes()method 
protected function parseAttributes(objectDefinition:IObjectDefinition, xml:XML):void

Parses the attributes of an object node into an object definition.

Parameters
objectDefinition:IObjectDefinition
 
xml:XML
parseConstructorArguments()method 
protected function parseConstructorArguments(objectDefinition:IObjectDefinition, xml:XML):void

Will retrieve the constructor arguments and parses them as if they were property nodes.

Parameters
objectDefinition:IObjectDefinition — The xml to check for nodes
 
xml:XML

See also

parseCustomNode()method 
protected function parseCustomNode(node:XML):void

Parameters
node:XML
parseDefaultNode()method 
protected function parseDefaultNode(node:XML):void

Parameters
node:XML
parseMethodInvocation()method 
protected function parseMethodInvocation(node:XML):MethodInvocation

Parameters
node:XML

Returns
MethodInvocation
parseMethodInvocations()method 
protected function parseMethodInvocations(objectDefinition:IObjectDefinition, xml:XML):void

Parses the method invocations of the given definition.

Parameters
objectDefinition:IObjectDefinition
 
xml:XML
parseNode()method 
public function parseNode(node:XML):voidParameters
node:XML
parseObjectDefinition()method 
public function parseObjectDefinition(xml:XML, objectDefinition:IObjectDefinition = null):IObjectDefinition

Parses the given object definition node into an implementation of IObjectDefinition.

Parameters
xml:XML — The object definition node
 
objectDefinition:IObjectDefinition (default = null)

Returns
IObjectDefinition — an implementation of IObjectDefinition
parseObjectDefinitions()method 
protected function parseObjectDefinitions(xml:XML):void

Parameters
xml:XML
parseProperties()method 
protected function parseProperties(objectDefinition:IObjectDefinition, xml:XML):void

Parses the properties of the given definition.

Parameters
objectDefinition:IObjectDefinition
 
xml:XML
parseProperty()method 
public function parseProperty(node:XML):Object

Will parse the given property node. If the given property does not contain a value attribute, the first childNode will be used as value else the value of the property will be parsed and returned using the parsePropertyValue method.

Parameters
node:XML — The property node to be parsed

Returns
Object — the value of the parsed node

See also

parsePropertyValue()method 
public function parsePropertyValue(node:XML):Object

Will parse the given property value using the node parsers.

Will loop through the node parsers in the order that they have been added. The first parser able to parse the node is used to retrieve the value.

Parameters
node:XML — The property value node to be parsed

Returns
Object — the value of the node after parsing
preProcessXML()method 
protected function preProcessXML(xml:XML):void

Pre process the xml data before parsing.

Parameters
xml:XML
processObjectDefinition()method 
protected function processObjectDefinition(node:XML):void

Process the given node as an object definition.

Parameters
node:XML
registerObjectDefinition()method 
public function registerObjectDefinition(objectName:String, objectDefinition:IObjectDefinition):void

Registers an object definition in the internal object factory.

Parameters
objectName:String — the name of the object
 
objectDefinition:IObjectDefinition — the object definition
Constant detail
ABSTRACT_ATTRIBUTEconstant
public static const ABSTRACT_ATTRIBUTE:String = "abstract"
ARRAY_COLLECTION_ELEMENTconstant 
public static const ARRAY_COLLECTION_ELEMENT:String = "array-collection"

Constant value 'array-collection'

ARRAY_ELEMENTconstant 
public static const ARRAY_ELEMENT:String = "array"

Constant value 'array'

AUTOWIRE_CANDIDATE_ATTRIBUTEconstant 
public static const AUTOWIRE_CANDIDATE_ATTRIBUTE:String = "autowire-candidate"
AUTOWIRE_MODE_ATTRIBUTEconstant 
public static const AUTOWIRE_MODE_ATTRIBUTE:String = "autowire"
AUTOWIRE_PRIMARY_CANDIDATE_ATTRIBUTEconstant 
public static const AUTOWIRE_PRIMARY_CANDIDATE_ATTRIBUTE:String = "primary"
CLASS_ATTRIBUTEconstant 
public static const CLASS_ATTRIBUTE:String = "class"
CONSTRUCTOR_ARG_ELEMENTconstant 
public static const CONSTRUCTOR_ARG_ELEMENT:String = "constructor-arg"

Constant value 'constructor-arg'

DEPENDENCY_CHECK_ATTRIBUTEconstant 
public static const DEPENDENCY_CHECK_ATTRIBUTE:String = "dependency-check"
DEPENDS_ON_ATTRIBUTEconstant 
public static const DEPENDS_ON_ATTRIBUTE:String = "depends-on"
DESTROY_METHOD_ATTRIBUTEconstant 
public static const DESTROY_METHOD_ATTRIBUTE:String = "destroy-method"
DICTIONARY_ELEMENTconstant 
public static const DICTIONARY_ELEMENT:String = "dictionary"

Constant value 'dictionary'

ENTRY_ELEMENENTconstant 
public static const ENTRY_ELEMENENT:String = "entry"

Constant value 'entry'

FACTORY_METHOD_ATTRIBUTEconstant 
public static const FACTORY_METHOD_ATTRIBUTE:String = "factory-method"
FACTORY_OBJECT_ATTRIBUTEconstant 
public static const FACTORY_OBJECT_ATTRIBUTE:String = "factory-object"
ID_ATTRIBUTEconstant 
public static const ID_ATTRIBUTE:String = "id"
INIT_METHOD_ATTRIBUTEconstant 
public static const INIT_METHOD_ATTRIBUTE:String = "init-method"
KEY_ATTRIBUTEconstant 
public static const KEY_ATTRIBUTE:String = "key"
KEY_ELEMENTconstant 
public static const KEY_ELEMENT:String = "key"

Constant value 'key'

LAZY_INIT_ATTRIBUTEconstant 
public static const LAZY_INIT_ATTRIBUTE:String = "lazy-init"
LIST_ELEMENTconstant 
public static const LIST_ELEMENT:String = "list"

Constant value 'list'

MAP_ELEMENTconstant 
public static const MAP_ELEMENT:String = "map"

Constant value 'map'

METHOD_INVOCATIONconstant 
public static const METHOD_INVOCATION:String = "method-invocation"

Constant value 'method-invocation'

NULL_ELEMENTconstant 
public static const NULL_ELEMENT:String = "null"

Constant value 'null'

OBJECT_ELEMENTconstant 
public static const OBJECT_ELEMENT:String = "object"

Constant value 'object'

OBJECT_NAME_DELIMITERSconstant 
public static const OBJECT_NAME_DELIMITERS:String = ",; "
PROPERTY_ELEMENTconstant 
public static const PROPERTY_ELEMENT:String = "property"

Constant value 'property'

REF_ATTRIBUTEconstant 
public static const REF_ATTRIBUTE:String = "ref"
REF_ELEMENTconstant 
public static const REF_ELEMENT:String = "ref"

Constant value 'ref'

SCOPE_ATTRIBUTEconstant 
public static const SCOPE_ATTRIBUTE:String = "scope"
SKIP_METADATAconstant 
public static const SKIP_METADATA:String = "skip-metadata"

Constant value 'method-invocation'

SKIP_POSTPROCESSORSconstant 
public static const SKIP_POSTPROCESSORS:String = "skip-postprocessors"

Constant value 'skip-postprocessors'

TEMPLATE_ELEMENTconstant 
public static const TEMPLATE_ELEMENT:String = "template"

Constant value 'template'

VALUE_ATTRIBUTEconstant 
public static const VALUE_ATTRIBUTE:String = "value"
VALUE_ELEMENTconstant 
public static const VALUE_ELEMENT:String = "value"

Constant value 'value'

VECTOR_ELEMENTconstant 
public static const VECTOR_ELEMENT:String = "vector"

Constant value 'vector'