Search this API

y.io.graphml.output
Class SerializationEvent

java.lang.Object
  extended by java.util.EventObject
      extended by y.io.graphml.output.SerializationEvent
All Implemented Interfaces:
java.io.Serializable

public final class SerializationEvent
extends java.util.EventObject

The event arguments used by SerializationHandlers to let registered serialization code perform the serialization of items.

If the event handler determines that it can serialize the getItem(), it should use the getWriter() for output and mark the event as isHandled() so that other code will not perform serialization, too.

See Also:
Serialized Form
 

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
SerializationEvent(java.lang.Object source, GraphMLWriteContext context, java.lang.Object item)
          Initializes a new instance of the SerializationEvent class the item.
SerializationEvent(java.lang.Object source, GraphMLWriteContext context, java.lang.Object item, java.lang.Class serializationType)
          Initializes a new instance of the SerializationEvent class the item
 
Method Summary
 GraphMLWriteContext getContext()
          Gets the context to be used for writing.
 java.lang.Object getItem()
          Gets the item that should be serialized.
 XmlWriter getWriter()
          Gets the writer for writing the xml output.
 boolean isHandled()
          Gets a value indicating whether this SerializationEvent is handled.
 void setHandled(boolean value)
          Sets a value indicating whether this SerializationEvent is handled.
 java.lang.Class SourceType()
          Declares the type in the inheritance of the getItem() that should be used for serialization.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SerializationEvent

public SerializationEvent(java.lang.Object source,
                          GraphMLWriteContext context,
                          java.lang.Object item)
Initializes a new instance of the SerializationEvent class the item.

This constructor initializes the SourceType() to null.

Parameters:
source - The source where the event was raised.
context - The context to use for writing.
item - The item to to serialize.

SerializationEvent

public SerializationEvent(java.lang.Object source,
                          GraphMLWriteContext context,
                          java.lang.Object item,
                          java.lang.Class serializationType)
Initializes a new instance of the SerializationEvent class the item

Parameters:
source - The source where the event was raised.
context - The context to use for writing.
item - The item to to serialize.
serializationType - The type that should be used for serialization, which needs to be a super type or interface of the item or null.
Method Detail

getItem

public java.lang.Object getItem()
Gets the item that should be serialized.

Returns:
The item.

SourceType

public java.lang.Class SourceType()
Declares the type in the inheritance of the getItem() that should be used for serialization.

Returns:
The type of the serialization or null if the type should be inferred from the getItem().

isHandled

public boolean isHandled()
Gets a value indicating whether this SerializationEvent is handled.

A true value indicates to the event source that the getItem() has been successfully serialized using the getWriter() and no other code needs to handle the serialization request, anymore.

Returns:
true if this event has been handled; false otherwise.

setHandled

public void setHandled(boolean value)
Sets a value indicating whether this SerializationEvent is handled.

Setting this property to true indicates to the event source that the getItem() has been successfully serialized using the getWriter() and no other code needs to handle the serialization request, anymore.

Parameters:
value - true if this event has been handled; false otherwise.

getContext

public GraphMLWriteContext getContext()
Gets the context to be used for writing.

Returns:
The context.

getWriter

public XmlWriter getWriter()
Gets the writer for writing the xml output.

Returns:
The writer that writes the GraphML xml.

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