Search this API

y.io.graphml.graph2d
Interface ResourceSerializationHandler


public interface ResourceSerializationHandler

Interface for classes that provide methods to manage shared object resources for the output process

 
Your browser does not support SVG content.

Method Summary
 java.util.Collection getDescriptors()
          Returns all currently registered ResourceDescriptor instances.
 boolean isRegistered(java.lang.Object resource)
          Return whether a resource has already been registered at this handler
 ResourceDescriptor registerResource(java.lang.Object resource, SerializationHandler encoder)
          Register a shared resource to this handler.
 ResourceDescriptor registerResource(java.lang.Object resource, SerializationHandler encoder, java.lang.String typeString)
          Register a shared resource to this handler.
 void writeResources(GraphMLWriteContext context, XmlWriter writer)
          Writes the registered resources using the supplied writer and context.
 

Method Detail

registerResource

ResourceDescriptor registerResource(java.lang.Object resource,
                                    SerializationHandler encoder)
Register a shared resource to this handler.

On the first call for a shared object resource, this should create and return a descriptor for the resource. On further calls for the same resource, this should return only the descriptor reference.

Parameters:
resource - the shared resource
encoder - The encoder instance that is used when the resource is serialized. If null, GraphMLWriteContext.serialize(y.io.graphml.output.GraphMLWriteContext, Object, Class) is called to serialize the resource.
Returns:
ResourceDescriptor reference that can be used to set further aspects for the resource serialization

registerResource

ResourceDescriptor registerResource(java.lang.Object resource,
                                    SerializationHandler encoder,
                                    java.lang.String typeString)
Register a shared resource to this handler.

On the first call for a shared object resource, this should create and return a descriptor for the resource. On further calls for the same resource, this should return only the descriptor reference.

Parameters:
resource - the shared resource
encoder - The encoder instance that is used when the resource is serialized. If null, GraphMLWriteContext.serialize(y.io.graphml.output.GraphMLWriteContext, Object, Class) is called to serialize the resource.
typeString - An identifier for the type of the resource. If null, no identifier is written.
Returns:
ResourceDescriptor reference that can be used to set further aspects for the resource serialization

isRegistered

boolean isRegistered(java.lang.Object resource)
Return whether a resource has already been registered at this handler

Parameters:
resource - The resource to check
Returns:
true iff the resource has already been registered

getDescriptors

java.util.Collection getDescriptors()
Returns all currently registered ResourceDescriptor instances.

Returns:
all currently registered ResourceDescriptor instances.

writeResources

void writeResources(GraphMLWriteContext context,
                    XmlWriter writer)
                    throws GraphMLWriteException
Writes the registered resources using the supplied writer and context.

Parameters:
context - the write context
writer - the writer
Throws:
GraphMLWriteException - if a resource could not be written

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