Search this API

y.io.graphml.input
Class AbstractDeserializer

java.lang.Object
  extended by y.io.graphml.input.AbstractDeserializer
All Implemented Interfaces:
java.util.EventListener, DeserializationHandler
Direct Known Subclasses:
NameBasedDeserializer

public abstract class AbstractDeserializer
extends java.lang.Object
implements DeserializationHandler

Convenience base class for implementations of DeserializationEvent

 

Constructor Summary
AbstractDeserializer()
           
 
Method Summary
abstract  boolean canHandle(DeserializationEvent e)
          Predicate member method to determine whether this instance should react to a given DeserializationEvent.
abstract  java.lang.Object deserializeNode(org.w3c.dom.Node xmlNode, GraphMLParseContext context)
          Actually perform the deserialization for the given arguments.
 void onHandleDeserialization(DeserializationEvent event)
          Listen to a serialization event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDeserializer

public AbstractDeserializer()
Method Detail

onHandleDeserialization

public void onHandleDeserialization(DeserializationEvent event)
                             throws GraphMLParseException
Listen to a serialization event. This implementation checks if canHandle(DeserializationEvent) returns true for the supplied event argument, in which case it calls deserializeNode(Node,GraphMLParseContext) and sets DeserializationEvent.setResult(Object).
If canHandle(DeserializationEvent) returns false, no action is performed.

Specified by:
onHandleDeserialization in interface DeserializationHandler
Parameters:
event - The event to handle
Throws:
GraphMLParseException - if something went wrong in the serialization process.

deserializeNode

public abstract java.lang.Object deserializeNode(org.w3c.dom.Node xmlNode,
                                                 GraphMLParseContext context)
                                          throws GraphMLParseException
Actually perform the deserialization for the given arguments. This method is called from onHandleDeserialization(DeserializationEvent) if canHandle(DeserializationEvent) returns true.

Parameters:
xmlNode - The xml Node to parse.
context - The current parse context.
Returns:
The deserialized value of xmlNode.
Throws:
GraphMLParseException

canHandle

public abstract boolean canHandle(DeserializationEvent e)
Predicate member method to determine whether this instance should react to a given DeserializationEvent.

Parameters:
e - The event data.
Returns:
true iff this instance should handle the event.

© Copyright 2000-2022,
yWorks GmbH.
All rights reserved.