Packagecom.yworks.io.graphml.reader
Classpublic class ReferenceResolver
InheritanceReferenceResolver Inheritance Object

This class is responsible for resolving reference stubs



Public Methods
 MethodDefined By
  
ReferenceResolver(xmlRefs:Object)
Create a new Resolver instance
ReferenceResolver
  
addReference(refid:String, refNode:XML):void
Add a reference node for the given refid.
ReferenceResolver
  
deserialize(context:GraphMLParseContext, element:XML, deserializer:IDeserializer):Object
[static] Deserialize the given xml element.
ReferenceResolver
  
Return a IDeserializer instance that has already been used for a specific refid.
ReferenceResolver
  
Return the best resolution of a refid node (i.e.
ReferenceResolver
  
resolveElementReference(context:GraphMLParseContext, refid:String):XML
Return the next resolution layer of a refid node.
ReferenceResolver
  
resolveReference(context:GraphMLParseContext, refid:String, deserializer:IDeserializer):Object
Resolve an xml node to an object instance.
ReferenceResolver
Constructor Detail
ReferenceResolver()Constructor
public function ReferenceResolver(xmlRefs:Object)

Create a new Resolver instance

Parameters
xmlRefs:Object — Dictionary that has pairs where the key is a string and the value is the corresponding node from the sharedData section in the GraphML input. It is the caller's responsibility to ensure this is setup correctly.
Method Detail
addReference()method
public function addReference(refid:String, refNode:XML):void

Add a reference node for the given refid.

Parameters

refid:String — the refid of the reference
 
refNode:XML — xml node that is referenced by refid

deserialize()method 
public static function deserialize(context:GraphMLParseContext, element:XML, deserializer:IDeserializer):Object

Deserialize the given xml element.

This method supports deserialization of shared references, if a ReferenceResolver can be found in the context's lookup. If the element does not reference a shared instance, an IDeserializer is retrieved from the context for deserialization.

Parameters

context:GraphMLParseContext
 
element:XML
 
deserializer:IDeserializer

Returns
Object
getDeserializerForRefid()method 
public function getDeserializerForRefid(context:GraphMLParseContext, refid:String):IDeserializer

Return a IDeserializer instance that has already been used for a specific refid.

This is a convenience method to shorten deserializer lookups, not a complete factory getter, i.e. a return value of null does not mean there is no deserialzer for the refid, only that no one has already been cached.

Parameters

context:GraphMLParseContext — The current parse context
 
refid:String — The refid

Returns
IDeserializer — A cached IDeserializer instance for refid, if one has been cached, null otherwise.
resolveCompleteElementReference()method 
public function resolveCompleteElementReference(context:GraphMLParseContext, refid:String):XML

Return the best resolution of a refid node (i.e. a node that has no refid attribute left)

Parameters

context:GraphMLParseContext — the parse context
 
refid:String — The reference id.

Returns
XML — the refid node
resolveElementReference()method 
public function resolveElementReference(context:GraphMLParseContext, refid:String):XML

Return the next resolution layer of a refid node. Possibly the result can be resolved further.

Parameters

context:GraphMLParseContext — the parse context
 
refid:String — The reference id.

Returns
XML — the refid node
resolveReference()method 
public function resolveReference(context:GraphMLParseContext, refid:String, deserializer:IDeserializer):Object

Resolve an xml node to an object instance.

This method returns shared instances for nodes with the same refid

Parameters

context:GraphMLParseContext — The current nparse context
 
refid:String — The refid which should be resolved. Must not be null
 
deserializer:IDeserializer — Deserializer from which resolver is called. Can be null when not called from a deserializer instance, in which case the resolver tries to find a matching deserializer itself.

Returns
Object — The deserialized object