Packageorg.spicefactory.lib.xml.mapper.handler
Classpublic class AbstractPropertyHandler
InheritanceAbstractPropertyHandler Inheritance Object
Implements PropertyHandler
Subclasses AbstractChildElementHandler, AttributeHandler, ChildTextNodeHandler, TextNodeHandler

Abstract base impelementation of the PropertyHandler interface.



Public Properties
 PropertyDefined By
  nodeKind : String
[read-only] The kind of the mapped node.
AbstractPropertyHandler
  property : Property
[read-only] The Property the XML element, attribute or text node should map to.
AbstractPropertyHandler
  xmlNames : Array
[read-only] The names of the mapped XML elements, attributes or text nodes.
AbstractPropertyHandler
Protected Properties
 PropertyDefined By
  required : Boolean
[read-only] Indicates whether this attribute is required.
AbstractPropertyHandler
  singleValue : Boolean
[read-only] Indicates whether this handler maps a single-valued or multi-valued (Array) property.
AbstractPropertyHandler
Public Methods
 MethodDefined By
  
AbstractPropertyHandler(property:Property, nodeKind:String, xmlNames:Array = null, allowArrayProperty:Boolean = false)
Creates a new instance.
AbstractPropertyHandler
  
toObject(nodes:Array, parentInstance:Object, context:XmlProcessorContext):void
Maps the specified XML elements, attributes or text nodes to the mapped property of the specified instance.
AbstractPropertyHandler
  
toXML(instance:Object, parentElement:XML, context:XmlProcessorContext):void
Maps the property value this handler is responsible for to the specified XML elements.
AbstractPropertyHandler
Protected Methods
 MethodDefined By
  
getValue(instance:Object):*
Gets the value of the mapped property from the specified instance.
AbstractPropertyHandler
  
getValueAsString(instance:Object):String
Gets the value of the mapped property from the specified instance as a String.
AbstractPropertyHandler
  
Extracts the value from the specified node, resolving any variables that nodes with simple content possibly contain.
AbstractPropertyHandler
  
validateValueCount(count:int):void
Validates the specified number of mapped XML elements, attributes or text nodes.
AbstractPropertyHandler
Property Detail
nodeKindproperty
nodeKind:String  [read-only]

The kind of the mapped node. Either element, attribute or text.


Implementation
    public function get nodeKind():String
propertyproperty 
property:Property  [read-only]

The Property the XML element, attribute or text node should map to.


Implementation
    public function get property():Property
requiredproperty 
required:Boolean  [read-only]

Indicates whether this attribute is required.


Implementation
    protected function get required():Boolean
singleValueproperty 
singleValue:Boolean  [read-only]

Indicates whether this handler maps a single-valued or multi-valued (Array) property.


Implementation
    protected function get singleValue():Boolean
xmlNamesproperty 
xmlNames:Array  [read-only]

The names of the mapped XML elements, attributes or text nodes. For Array properties the Array may contain more than one XML name.


Implementation
    public function get xmlNames():Array
Constructor Detail
AbstractPropertyHandler()Constructor
public function AbstractPropertyHandler(property:Property, nodeKind:String, xmlNames:Array = null, allowArrayProperty:Boolean = false)

Creates a new instance.

Parameters
property:Property — the property the XML value should be applied to
 
nodeKind:String — the node kind (attribute, text or element)
 
xmlNames:Array (default = null) — the names of the mapped XML attributes or elements
 
allowArrayProperty:Boolean (default = false) — whether this handler is able to handle multi-value mappings
Method Detail
getValue()method
protected function getValue(instance:Object):*

Gets the value of the mapped property from the specified instance.

Parameters

instance:Object — the instance to get the property value from

Returns
* — the value of the mapped property from the specified instance
getValueAsString()method 
protected function getValueAsString(instance:Object):String

Gets the value of the mapped property from the specified instance as a String.

Parameters

instance:Object — the instance to get the property value from

Returns
String — the value of the mapped property from the specified instance as a String
getValueFromNode()method 
protected function getValueFromNode(node:XML, context:XmlProcessorContext):*

Extracts the value from the specified node, resolving any variables that nodes with simple content possibly contain.

Parameters

node:XML — the node to extract the value from
 
context:XmlProcessorContext — the processing context

Returns
* — the value extracted fron the node to be applied to the property
toObject()method 
public function toObject(nodes:Array, parentInstance:Object, context:XmlProcessorContext):void

Maps the specified XML elements, attributes or text nodes to the mapped property of the specified instance.

Parameters

nodes:Array — the XML elements, attributes or text nodes to apply as a property value
 
parentInstance:Object — the instance the property should be set for
 
context:XmlProcessorContext — the processing context

toXML()method 
public function toXML(instance:Object, parentElement:XML, context:XmlProcessorContext):void

Maps the property value this handler is responsible for to the specified XML elements.

Parameters

instance:Object — the instance the to read the property value from
 
parentElement:XML — the XML element to apply the property value to, either as an attribute, text node or child element
 
context:XmlProcessorContext — the processing context

validateValueCount()method 
protected function validateValueCount(count:int):void

Validates the specified number of mapped XML elements, attributes or text nodes. For any invalid number this method throws an Error.

Parameters

count:int