Package | org.spicefactory.lib.xml.mapper.handler |
Class | public class AbstractPropertyHandler |
Inheritance | AbstractPropertyHandler Object |
Implements | PropertyHandler |
Subclasses | AbstractChildElementHandler, AttributeHandler, ChildTextNodeHandler, TextNodeHandler |
Property | Defined 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 |
Property | Defined 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 |
Method | Defined 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 |
Method | Defined 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 | ||
getValueFromNode(node:XML, context:XmlProcessorContext):*
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 |
nodeKind | property |
nodeKind:String
[read-only]
The kind of the mapped node. Either element
, attribute
or text
.
public function get nodeKind():String
property | property |
property:Property
[read-only] The Property the XML element, attribute or text node should map to.
public function get property():Property
required | property |
required:Boolean
[read-only] Indicates whether this attribute is required.
protected function get required():Boolean
singleValue | property |
singleValue:Boolean
[read-only] Indicates whether this handler maps a single-valued or multi-valued (Array) property.
protected function get singleValue():Boolean
xmlNames | property |
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.
public function get xmlNames():Array
AbstractPropertyHandler | () | Constructor |
public function AbstractPropertyHandler(property:Property, nodeKind:String, xmlNames:Array = null, allowArrayProperty:Boolean = false)
Creates a new instance.
Parametersproperty: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
|
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
|
* — 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
|
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
|
* — 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 |