Packagecom.yworks.io.graphml.reader
Classpublic class ObjectMapperAttributeInputHandler
InheritanceObjectMapperAttributeInputHandler Inheritance AbstractInputHandler Inheritance Object

Input handler for reading complex mapper data using a provided IDeserializer instance.



Public Properties
 PropertyDefined By
  autoCreateMapper : Boolean
[read-only] Describes if a mapper shall be added to the graph's mapper registry using the tag passed to the constructor if no such mapper is in the registry, yet.
ObjectMapperAttributeInputHandler
Public Methods
 MethodDefined By
  
ObjectMapperAttributeInputHandler(scopeType:String, tag:Object, deserializer:IDeserializer = null, autoCreateMapper:Boolean = false)
Create a new instance that will parse complex mapper data using the provided deserializer and store the resulting objects in a mapper that is retrieved from the graph using the provided mapper tag.
ObjectMapperAttributeInputHandler
  
acceptKey(keyElement:XML, scopeType:String):Boolean
[override] This method defines whether a specific key/data pair is handled by the input handler.
ObjectMapperAttributeInputHandler
 Inherited
applyDefault(context:GraphMLParseContext, defaultElement:XML, value:Object):void
This method is invoked when no data tag is defined, and the default value should be applied.
AbstractInputHandler
 Inherited
getAttributeName(keyElement:XML):String
[static] Returns the value of the first attribute with the name GraphMLConstants.ATTR_NAME.
AbstractInputHandler
 Inherited
getAttributeType(keyElement:XML):String
[static] Returns the value of the first attribute with the name GraphMLConstants.ATTR_TYPE.
AbstractInputHandler
  
Initializes this input handler.
ObjectMapperAttributeInputHandler
 Inherited
parseData(context:GraphMLParseContext, defaultValue:Boolean, dataElement:XML):void
Forwards to parseItemData This method is invoked each time a data element with matching key is processed.
AbstractInputHandler
  
parseDefaultData(context:GraphMLParseContext, keyElement:XML):Object
[override] This method is invoked when the default value of the key element for a data element is parsed.
ObjectMapperAttributeInputHandler
Protected Methods
 MethodDefined By
  
Called if the mapper instance is not found in the graph's mapperRegistry and autoCreateMapper is true.
ObjectMapperAttributeInputHandler
  
Returns the name that will be used for the GraphML attribute.
ObjectMapperAttributeInputHandler
  
Returns the IMapper which is handled by this instance.
ObjectMapperAttributeInputHandler
  
parseItemData(context:GraphMLParseContext, graph:IGraph, item:Object, defaultMode:Boolean, element:XML):void
[override] Parse the element for the given item.
ObjectMapperAttributeInputHandler
Property Detail
autoCreateMapperproperty
autoCreateMapper:Boolean  [read-only]

Describes if a mapper shall be added to the graph's mapper registry using the tag passed to the constructor if no such mapper is in the registry, yet.


Implementation
    public function get autoCreateMapper():Boolean
Constructor Detail
ObjectMapperAttributeInputHandler()Constructor
public function ObjectMapperAttributeInputHandler(scopeType:String, tag:Object, deserializer:IDeserializer = null, autoCreateMapper:Boolean = false)

Create a new instance that will parse complex mapper data using the provided deserializer and store the resulting objects in a mapper that is retrieved from the graph using the provided mapper tag.

Parameters
scopeType:String — The scope type of the attribute. One of
  • GraphMLConstants.SCOPE_NODE
  • GraphMLConstants.SCOPE_EDGE
  • GraphMLConstants.SCOPE_PORT
  • GraphMLConstants.SCOPE_GRAPH
  • GraphMLConstants.SCOPE_GRAPHML
  • GraphMLConstants.SCOPE_ALL
 
tag:Object — The tag that will be used to retrieve the mapper instance from the graph's mapperRegistry
 
deserializer:IDeserializer (default = null) — The deserializer instance that will be used for parsing the complex data objects.
 
autoCreateMapper:Boolean (default = false)
Method Detail
acceptKey()method
override public function acceptKey(keyElement:XML, scopeType:String):Boolean

This method defines whether a specific key/data pair is handled by the input handler. When it returns true, each occurence of data elements which match the id of the key element are forwarded to the input handler.

Parameters

keyElement:XML — the key element
 
scopeType:String — the scope type for which the key is defined.

One of

  • GraphMLConstants.SCOPE_ALL
  • GraphMLConstants.SCOPE_GRAPH
  • GraphMLConstants.SCOPE_NODE
  • GraphMLConstants.SCOPE_EDGE
  • GraphMLConstants.SCOPE_PORT

Returns
Booleantrue, if this hanlder can handle the data elements asked for.
createMapper()method 
protected function createMapper():IMapper

Called if the mapper instance is not found in the graph's mapperRegistry and autoCreateMapper is true.

Returns
IMapper
getAttributeName()method 
protected function getAttributeName():String

Returns the name that will be used for the GraphML attribute.

The default implementation just converts the tag that was passed to the constructor to a String.

Returns
String
getMapper()method 
protected function getMapper(graph:IGraph):IMapper

Returns the IMapper which is handled by this instance.

This implementation tries to retrieve the mapper from the given graph. If no mapper is registered yet and this instance is created with autoCreateMapper set to true a new mapper will be created by createMapper and registered at the graph's mapper registry.

Parameters

graph:IGraph — The graph to get the mapper from.

Returns
IMapper — The mapper which is handled by this instance.
initialize()method 
public function initialize(context:GraphMLParseContext):void

Initializes this input handler. This method is called by AutoMapperInputHandlerProvider.

Parameters

context:GraphMLParseContext — The current parse context.

parseDefaultData()method 
override public function parseDefaultData(context:GraphMLParseContext, keyElement:XML):Object

This method is invoked when the default value of the key element for a data element is parsed.

Parameters

context:GraphMLParseContext — the current parse context.
 
keyElement:XML — the xml node representing the key element.

Returns
Objectnull
parseItemData()method 
override protected function parseItemData(context:GraphMLParseContext, graph:IGraph, item:Object, defaultMode:Boolean, element:XML):void

Parse the element for the given item. This method has to be overridden by subclass implementations.

Parameters

context:GraphMLParseContext — The current parse context
 
graph:IGraph — The current graph
 
item:Object — The current edge
 
defaultMode:Boolean — Whether to parse default data
 
element:XML — The current xml data element