Packagecom.yworks.io.graphml.reader
Classpublic class AutoMapperAttributeInputHandler
InheritanceAutoMapperAttributeInputHandler Inheritance Object
Implements IInputHandler

An input handler that parses simple mapper attributes into a mapper that has been registered with the graph's mapper registry.

For reading complex mapper data, use ObjectMapperAttributeInputHandler instead.

See also

ObjectMapperAttributeInputHandler


Public Properties
 PropertyDefined By
  autoCreateMapper : Boolean
Whether to create a new mapper instance if no mapper is found in the graph's mapper registry for the provided mapper attribute name.
AutoMapperAttributeInputHandler
Public Methods
 MethodDefined By
  
AutoMapperAttributeInputHandler(attributeName:String, scopeType:String, valueType:String, autoCreateMapper:Boolean = true)
AutoMapperAttributeInputHandler
  
acceptKey(keyElement:XML, scopeType:String):Boolean
Whether this data handler can parse a data section with the given key and scope type.
AutoMapperAttributeInputHandler
  
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.
AutoMapperAttributeInputHandler
  
Initializes this input handler.
AutoMapperAttributeInputHandler
  
parseData(context:GraphMLParseContext, defaultValue:Boolean, dataElement:XML):void
This method is invoked each time a data element with matching key is processed.
AutoMapperAttributeInputHandler
  
parseDefaultData(context:GraphMLParseContext, keyElement:XML):Object
This method is invoked when the default value of the key element for a data tag is parsed.
AutoMapperAttributeInputHandler
Protected Methods
 MethodDefined By
  
Create a mapper to store the parsed mapper values, if autoCreateMapper is true and no matching mapper has been registered with the graph's mapper registry.
AutoMapperAttributeInputHandler
  
Get the mapper that will be used to store the parsed mapper values.
AutoMapperAttributeInputHandler
Property Detail
autoCreateMapperproperty
autoCreateMapper:Boolean

Whether to create a new mapper instance if no mapper is found in the graph's mapper registry for the provided mapper attribute name.


Implementation
    public function get autoCreateMapper():Boolean
    public function set autoCreateMapper(value:Boolean):void

See also

Constructor Detail
AutoMapperAttributeInputHandler()Constructor
public function AutoMapperAttributeInputHandler(attributeName:String, scopeType:String, valueType:String, autoCreateMapper:Boolean = true)

Parameters
attributeName:String — The name of the mapper attribute. The input handler will try to retrieve a mapper from the graph's mapper registry using the attribute name.
 
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
 
valueType:String — The attribute content type. One of
  • GraphMLConstants.TYPE_STRING
  • GraphMLConstants.TYPE_LONG
  • GraphMLConstants.TYPE_INT
  • GraphMLConstants.TYPE_FLOAT
  • GraphMLConstants.TYPE_DOUBLE
  • GraphMLConstants.TYPE_BOOLEAN
 
autoCreateMapper:Boolean (default = true) — Whether a new mapper instance should be created if no mapper has been registered with the graph's mapper registry for the provided attribute name.

See also

Method Detail
acceptKey()method
public function acceptKey(keyElement:XML, scopeType:String):Boolean

Whether this data handler can parse a data section with the given key and scope type.

Parameters

keyElement:XML — the xml element which contains the key
 
scopeType:String — the scope type that contains the data section

Returns
Boolean — true if this data can parse a data section with this key and scopeType.
applyDefault()method 
public function 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.

Parameters

context:GraphMLParseContext — the current parse context.
 
defaultElement:XML — he default xml element.
 
value:Object — the parsed value of the default element

createMapper()method 
protected function createMapper(graph:IGraph = null):DictionaryMapper

Create a mapper to store the parsed mapper values, if autoCreateMapper is true and no matching mapper has been registered with the graph's mapper registry.

Parameters

graph:IGraph (default = null)

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

Get the mapper that will be used to store the parsed mapper values.

If no matching mapper is found in the graph's mapper registry and autoCreateMapper is true, the mapper is created using createMapper() an registered with the graph's mapper registry.

Parameters

graph:IGraph

Returns
IMapper

See also

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.

parseData()method 
public function parseData(context:GraphMLParseContext, defaultValue:Boolean, dataElement:XML):void

This method is invoked each time a data element with matching key is processed. Parse a data element of a graphml file.

Parameters

context:GraphMLParseContext — the parse context
 
defaultValue:Booleantrue when the default value, which is included in the key element, is processed, false otherwise.
 
dataElement:XML — The data element of the graphml file.

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

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

Parameters

context:GraphMLParseContext — The current parse context.
 
keyElement:XML — The xml node that represents the key element

Returns
Object — The parsed value of the xml element, may be null.