Packageorg.spicefactory.lib.xml.mapper
Classpublic class SimpleValueMapper
InheritanceSimpleValueMapper Inheritance AbstractXmlObjectMapper Inheritance Object

A mapper implementation that maps elements with a text node to simple types like String or int. This is a different type of mapper compared to the standard mappers created by the XmlObjectMappings class that always map to the properties of a particular class.



Public Properties
 PropertyDefined By
 InheritedelementName : QName
[read-only] The name of the elements the mapToXml method produces.
AbstractXmlObjectMapper
 InheritedobjectType : ClassInfo
[read-only] The type of the objects the mapToObject method produces.
AbstractXmlObjectMapper
Public Methods
 MethodDefined By
  
SimpleValueMapper(type:ClassInfo, name:QName, converter:Converter = null)
Creates a new instance.
SimpleValueMapper
  
mapToObject(element:XML, context:XmlProcessorContext = null):Object
[override] Maps from XML to object.
SimpleValueMapper
  
mapToXml(object:Object, context:XmlProcessorContext = null):XML
[override] Maps from object to XML.
SimpleValueMapper
Constructor Detail
SimpleValueMapper()Constructor
public function SimpleValueMapper(type:ClassInfo, name:QName, converter:Converter = null)

Creates a new instance.

Parameters
type:ClassInfo — the class to the XML element to
 
name:QName — the name of the XML element that holds the text node
 
converter:Converter (default = null) — the (optional) converter to use for converting the String values to the specified target type
Method Detail
mapToObject()method
override public function mapToObject(element:XML, context:XmlProcessorContext = null):Object

Maps from XML to object. Should always return objects of the type the objectType property was set to.

Parameters

element:XML — the XML element to be transformed to an object
 
context:XmlProcessorContext (default = null) — the processing context

Returns
Object — a new object that maps to the specified XML element
mapToXml()method 
override public function mapToXml(object:Object, context:XmlProcessorContext = null):XML

Maps from object to XML. Should always return XML elements with the name the elementName property was set to.

Parameters

object:Object — the object to be transformed to an XML element
 
context:XmlProcessorContext (default = null) — the processing context

Returns
XML — a new XML element that maps to the specified object