|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.io.graphml.output.GraphMLWriter
public class GraphMLWriter
Writer class for GraphML.
This class allows for low-level customization of the writing process. Usually, it is used by one of GraphMLHandler
's
write
methods which calls one the various write
method overloads. It should rarely be necessary to use this class directly.
GraphMLHandler
Constructor Summary | |
---|---|
GraphMLWriter()
|
Method Summary | |
---|---|
void |
addOutputHandlerProvider(OutputHandlerProvider provider)
Register an event listener that can be used to handle QueryOutputHandlersEvent s. |
void |
addSerializationHandler(SerializationHandler listener)
Register an event listener that can be used to handle SerializationEvent s. |
protected void |
configureDefaultOutputHandlers()
Register default event handlers for the QueryOutputHandlersEvent event. |
protected void |
configureDefaultSerializationHandlers()
Register default event handlers for the fireSerializationEvent(y.io.graphml.output.SerializationEvent) event. |
protected GraphMLWriteContext |
createWriteContext(Graph graph,
XmlWriter writer)
Create the initial GraphMLWriteContext instance. |
protected void |
fireQueryOutputHandlersEvent(QueryOutputHandlersEvent event)
Notifies all registered OutputHandlerProvider instances of event . |
protected void |
fireSerializationEvent(SerializationEvent event)
Notifies all registered SerializationHandler instances of event . |
protected java.util.Map |
getOutputHandlers(GraphMLWriteContext context)
Dynamically retrieve all OutputHandler that should be used for the current write process. |
java.lang.Object |
getSerializationProperty(java.lang.Object key)
Retrieve a serialization property that has been set by setSerializationProperty(Object,Object) . |
WriteEventHandler |
getWriteEventHandler()
Return a WriteEventHandler that can be used to subscribe to
various events in the write process. |
protected java.lang.Object |
lookup(java.lang.Class type)
Dynamically retrieve an instance of type . |
void |
removeLookup(java.lang.Class t)
Remove an implementation of t that has been set with setLookup(Class,Object) . |
void |
removeOutputHandlerProvider(OutputHandlerProvider provider)
Unregister an event listener that has been registered with addOutputHandlerProvider(OutputHandlerProvider) . |
void |
removeSerializationHandler(SerializationHandler listener)
Unregister an event listener that has been registered with addSerializationHandler(y.io.graphml.output.SerializationHandler) . |
void |
removeSerializationProperty(java.lang.Object key)
Remove a serialization property that has been set by setSerializationProperty(Object,Object) . |
protected void |
serialize(GraphMLWriteContext context,
java.lang.Object item,
java.lang.Class serializationType)
Serialize item to XML content. |
void |
setLookup(java.lang.Class t,
java.lang.Object instance)
Register an initial implementation of t for use with Lookup . |
void |
setSerializationProperty(java.lang.Object key,
java.lang.Object value)
Set an initial serialization property that allows to fine tune the write process. |
void |
write(Graph graph,
XmlWriter writer)
Write the GraphML representation of graph ,
Typically, this method is called indirectly from
GraphMLHandler.write(Graph,java.io.OutputStream) and it's overloads. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GraphMLWriter()
Method Detail |
---|
public void addOutputHandlerProvider(OutputHandlerProvider provider)
QueryOutputHandlersEvent
s.
Registering a listener allows to use OutputHandler
s dynamically, depending on the
actual graph data. For each write, a QueryOutputHandlersEvent
is fired and
propagated to all registered event listeners.
Usually, this method should not be used directly, register event listeners
with GraphMLHandler.addOutputHandlerProvider(OutputHandlerProvider)
on an GraphMLHandler
instance instead.
provider
- Event listener for the QueryInputHandlersEvent
fireQueryOutputHandlersEvent(QueryOutputHandlersEvent)
,
removeOutputHandlerProvider(OutputHandlerProvider)
,
GraphMLHandler.addOutputHandlerProvider(OutputHandlerProvider)
public void removeOutputHandlerProvider(OutputHandlerProvider provider)
addOutputHandlerProvider(OutputHandlerProvider)
.
provider
- Event listener for the QueryOutputHandlersEvent
fireQueryOutputHandlersEvent(QueryOutputHandlersEvent)
,
addOutputHandlerProvider(OutputHandlerProvider)
,
GraphMLHandler.removeOutputHandlerProvider(OutputHandlerProvider)
protected void fireQueryOutputHandlersEvent(QueryOutputHandlersEvent event) throws GraphMLWriteException
OutputHandlerProvider
instances of event
.
For each write, a QueryOutputHandlersEvent
is fired and
propagated to all registered event listeners.
event
- The event that has been raised.
GraphMLWriteException
OutputHandler
,
OutputHandlerProvider
,
addOutputHandlerProvider(OutputHandlerProvider)
,
GraphMLHandler.fireQueryOutputHandlersEvent(QueryOutputHandlersEvent)
public void addSerializationHandler(SerializationHandler listener)
SerializationEvent
s.
Registering a listener allows to use custom serialization code.
Usually, this method should not be used directly, register event listeners
with GraphMLHandler.addSerializationHandler(SerializationHandler)
on an GraphMLHandler
instance instead.
listener
- Event listener for the SerializationEvent
fireSerializationEvent(SerializationEvent)
,
removeSerializationHandler(y.io.graphml.output.SerializationHandler)
,
GraphMLHandler.addSerializationHandler(y.io.graphml.output.SerializationHandler)
public void removeSerializationHandler(SerializationHandler listener)
addSerializationHandler(y.io.graphml.output.SerializationHandler)
.
listener
- Event listener for the SerializationEvent
fireSerializationEvent(SerializationEvent)
,
addSerializationHandler(y.io.graphml.output.SerializationHandler)
,
GraphMLHandler.removeSerializationHandler(y.io.graphml.output.SerializationHandler)
protected void fireSerializationEvent(SerializationEvent event) throws GraphMLWriteException
SerializationHandler
instances of event
.
Usually, this method is called indirectly through calls to
GraphMLWriteContext.serialize(Object)
to write the XML representation of an object.
event
- The event that has been raised.
GraphMLWriteException
SerializationHandler
,
addSerializationHandler(y.io.graphml.output.SerializationHandler)
,
GraphMLWriteContext.serialize(Object)
,
GraphMLHandler.fireSerializationEvent(y.io.graphml.output.SerializationEvent)
protected void configureDefaultSerializationHandlers()
fireSerializationEvent(y.io.graphml.output.SerializationEvent)
event.
This implementation does not register any default event handlers
GraphMLHandler.configureSerializationHandlers(y.base.Graph,y.io.graphml.output.GraphMLWriter)
protected void configureDefaultOutputHandlers()
QueryOutputHandlersEvent
event.
This implementation does not register any default event handlers
GraphMLHandler.configureOutputHandlers(y.base.Graph,GraphMLWriter)
protected java.util.Map getOutputHandlers(GraphMLWriteContext context) throws GraphMLWriteException
OutputHandler
that should be used for the current write process.
Typically, this method is called only indirectly by the write process.
This implementation calls fireQueryOutputHandlersEvent(QueryOutputHandlersEvent)
, which in
turn raises the QueryOutputHandlersEvent
event.
context
- The current write context.
KeyScope
s as keys and a list of OutputHandler
for each scope as values.
GraphMLWriteException
protected void serialize(GraphMLWriteContext context, java.lang.Object item, java.lang.Class serializationType) throws GraphMLWriteException
item
to XML content.
Typically, this method is called only indirectly by calls to one of
GraphMLWriteContext
's serialize
. * methods.
This implementation calls fireSerializationEvent(y.io.graphml.output.SerializationEvent)
.
context
- The current write context.item
- The object should be serialized.
GraphMLWriteException
GraphMLWriteContext.serialize(Object)
,
GraphMLWriteContext.serialize(GraphMLWriteContext, Object, Class)
public void setSerializationProperty(java.lang.Object key, java.lang.Object value)
To dynamically set or change property values during the write process, create a new
ChildWriteContext
and set the property with the corresponding property handling methods.
key
- The key for the property.value
- The property value.getSerializationProperty(Object)
,
GraphMLWriteContext.getSerializationProperty(Object)
public void removeSerializationProperty(java.lang.Object key)
setSerializationProperty(Object,Object)
.
key
- The key for the property.GraphMLWriteContext.getSerializationProperty(Object)
,
setSerializationProperty(Object,Object)
public java.lang.Object getSerializationProperty(java.lang.Object key)
setSerializationProperty(Object,Object)
.
key
- The key for the property.GraphMLWriteContext.getSerializationProperty(Object)
,
setSerializationProperty(Object,Object)
public void setLookup(java.lang.Class t, java.lang.Object instance)
t
for use with Lookup
.
To dynamically modify lookup behaviour during the write process, create a new ChildWriteContext
and use the corresponding lookup handling methods.
t
- The type for which an implementation should be registeredinstance
- The implementation of t
for lookup retrieval.lookup
,
Lookup.lookup(Class)
public void removeLookup(java.lang.Class t)
t
that has been set with setLookup(Class,Object)
.
To dynamically modify lookup behaviour during the parse process, create a new ChildWriteContext
and use the corresponding lookup handling methods.
t
- The type for which an implementation should be removedsetLookup(Class,Object)
,
lookup
,
Lookup.lookup(Class)
protected java.lang.Object lookup(java.lang.Class type)
type
.
type
- The type for which an implementation is needed.
type
, or null
.Lookup.lookup(Class)
,
setLookup(Class,Object)
protected GraphMLWriteContext createWriteContext(Graph graph, XmlWriter writer)
GraphMLWriteContext
instance.
graph
- The graph that is written.writer
- The core XmlWriter
instance that does the actual writing of XML content.
GraphMLWriteContext
instance that is suitable for graph
.public void write(Graph graph, XmlWriter writer) throws GraphMLWriteException
graph
,
Typically, this method is called indirectly from
GraphMLHandler.write(Graph,java.io.OutputStream)
and it's overloads.
graph
- The graph instance that is populated.writer
- The writer that actually writes the XML content.
GraphMLWriteException
GraphMLHandler.write(Graph,java.io.OutputStream)
,
GraphMLHandler.write(Graph,java.io.OutputStream,String)
,
GraphMLHandler.write(Graph,java.io.Writer)
public WriteEventHandler getWriteEventHandler()
WriteEventHandler
that can be used to subscribe to
various events in the write process.
WriteEventHandler
implementation.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |