Search this API

y.io.graphml.output
Class AbstractSerializer

java.lang.Object
  extended by y.io.graphml.output.AbstractSerializer
All Implemented Interfaces:
java.util.EventListener, SerializationHandler
Direct Known Subclasses:
TypeBasedSerializer

public abstract class AbstractSerializer
extends java.lang.Object
implements SerializationHandler

Convenience base class for implementations of SerializationHandler

 
Your browser does not support SVG content.

Constructor Summary
AbstractSerializer()
           
 
Method Summary
abstract  boolean canHandle(SerializationEvent e)
          Predicate member method to determine whether this instance should react to a given SerializationEvent.
 void onHandleSerialization(SerializationEvent event)
          Listen to a serialization event.
abstract  void serializeItem(java.lang.Object item, XmlWriter writer, GraphMLWriteContext context)
          Actually perform the serialization for the given arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSerializer

public AbstractSerializer()
Method Detail

onHandleSerialization

public void onHandleSerialization(SerializationEvent event)
                           throws GraphMLWriteException
Listen to a serialization event. This implementation checks if canHandle(SerializationEvent) returns true for the supplied event argument, in which case it calls serializeItem(Object, XmlWriter,GraphMLWriteContext) and sets SerializationEvent.setHandled(boolean) to true.
If canHandle(SerializationEvent) returns false, no action is performed.

Specified by:
onHandleSerialization in interface SerializationHandler
Parameters:
event - The event to handle
Throws:
GraphMLWriteException - if something went wrong in the serialization process.

serializeItem

public abstract void serializeItem(java.lang.Object item,
                                   XmlWriter writer,
                                   GraphMLWriteContext context)
                            throws GraphMLWriteException
Actually perform the serialization for the given arguments. This method is called from onHandleSerialization(SerializationEvent) if canHandle(SerializationEvent) returns true.

Parameters:
item - The item to serialize.
writer - The writer for the output.
context - The current write context.
Throws:
GraphMLWriteException

canHandle

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

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

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