|
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.ChildWriteContext
public class ChildWriteContext
An GraphMLWriteContext
implementation for use in the context of GraphMLWriter
that wraps a given instance and delegates most of the calls to it but allows for modifying
setLookup(Class,Object)
and setSerializationProperty(Object,Object)
.
Constructor Summary | |
---|---|
ChildWriteContext(GraphMLWriteContext parentContext)
Initializes a new instance of the ChildWriteContext class that delegates to the given parent context. |
|
ChildWriteContext(GraphMLWriteContext parentContext,
java.lang.Object currentObject)
Initializes a new instance of the ChildWriteContext class that delegates to the provided context
and has the getCurrentObject() set to the given value. |
Method Summary | |
---|---|
java.lang.Object |
getCurrentObject()
Returns the most current (i.e. the last element) within the container hierarchy as it is returned by GraphMLWriteContext.getObjectStack() |
Graph |
getGraph()
Returns the currently active graph object |
java.util.Collection |
getObjectStack()
Returns the current nesting of graphs and graph elements. |
GraphMLWriteContext |
getParentContext()
Gets the parent context to which most calls are delegated. |
java.lang.Object |
getSerializationProperty(java.lang.Object key)
Get a property value that specifies information about how to handle specific cases |
WriteEventHandler |
getWriteEvents()
Returns an implementation of WriteEventHandler that allows to subscribe to various
events in the write process. |
XmlWriter |
getWriter()
Gets the core xml writer. |
java.lang.Object |
lookup(java.lang.Class type)
Returns an instance that implements the given type or null . |
void |
removeLookup(java.lang.Class t)
Removes a local lookup override that has been added. |
void |
removeSerializationProperty(java.lang.Object key)
Removes a previously locally setSerializationProperty(Object,Object) serialization property. |
void |
serialize(GraphMLWriteContext context,
java.lang.Object item,
java.lang.Class serializationType)
Serialize item to an XML representation. |
void |
serialize(java.lang.Object item)
Serialize item to an XML representation. |
void |
setLookup(java.lang.Class t,
java.lang.Object value)
Adds another lookup result to the local lookup override. |
void |
setSerializationProperty(java.lang.Object key,
java.lang.Object value)
Sets the local serialization property for the given key to the value. |
void |
setWriter(XmlWriter value)
Sets the core xml writer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChildWriteContext(GraphMLWriteContext parentContext, java.lang.Object currentObject)
ChildWriteContext
class that delegates to the provided context
and has the getCurrentObject()
set to the given value.
Since this constructor updates the object stack, it should not be used outside the core GraphML element writing framework.
If currentObject
is a Graph
instance, the getGraph()
property
is also updated accordingly.
parentContext
- The parent context to delegate calls to.currentObject
- The current Object to assign to getCurrentObject()
.getObjectStack()
,
getCurrentObject()
,
getGraph()
public ChildWriteContext(GraphMLWriteContext parentContext)
ChildWriteContext
class that delegates to the given parent context.
This constructor does not change the object stack.
parentContext
- The parent context.Method Detail |
---|
public java.lang.Object lookup(java.lang.Class type)
Lookup
null
.
Typically, this method will be called in order to obtain a different view
or aspect of the current instance. This is quite similar to casting or
compile time constraints. An instance implementing this method is not
required to return non-null
implementations for the types, nor
does it have to return the same instance any time. Additionally, it depends
on the type and context whether the instance returned stays up to date or
needs to be retrieved again for subsequent use.
lookup
in interface Lookup
type
- the type for which an instance shall be returned
null
public void setLookup(java.lang.Class t, java.lang.Object value)
value
- The value to provide for queries to t
.removeLookup(Class)
,
lookup(Class)
public void removeLookup(java.lang.Class t)
t
- The type to remove from the local lookup.setLookup(Class,Object)
,
lookup(Class)
public java.util.Collection getObjectStack()
GraphMLWriteContext
The list contains the user objects which correspond to the graphml elements.
getObjectStack
in interface GraphMLWriteContext
public java.lang.Object getCurrentObject()
GraphMLWriteContext
GraphMLWriteContext.getObjectStack()
getCurrentObject
in interface GraphMLWriteContext
public WriteEventHandler getWriteEvents()
GraphMLWriteContext
WriteEventHandler
that allows to subscribe to various
events in the write process.
getWriteEvents
in interface GraphMLWriteContext
WriteEventHandler
instance.public GraphMLWriteContext getParentContext()
public XmlWriter getWriter()
getWriter
in interface GraphMLWriteContext
setWriter(XmlWriter)
public void setWriter(XmlWriter value)
If a null
writer is set, this implementation will delegate to
the getParentContext()
's GraphMLWriteContext.getWriter()
.
value
- The XmlWriter instance used for actual XML generation.getWriter()
public Graph getGraph()
GraphMLWriteContext
getGraph
in interface GraphMLWriteContext
public java.lang.Object getSerializationProperty(java.lang.Object key)
GraphMLWriteContext
getSerializationProperty
in interface GraphMLWriteContext
key
- The identifier for the property
null
if no such property existspublic void serialize(java.lang.Object item) throws GraphMLWriteException
GraphMLWriteContext
item
to an XML representation.
serialize
in interface GraphMLWriteContext
item
- The object that should be serialized.
GraphMLWriteException
public void serialize(GraphMLWriteContext context, java.lang.Object item, java.lang.Class serializationType) throws GraphMLWriteException
GraphMLWriteContext
item
to an XML representation.
This method is reserved for special use cases. Usually, you should just call GraphMLWriteContext.serialize(Object)
instead.
serialize
in interface GraphMLWriteContext
context
- The current write context.item
- The object that should be serialized.serializationType
- The actual type of the serialization, in case it differs from the type of item
.
GraphMLWriteException
public void setSerializationProperty(java.lang.Object key, java.lang.Object value)
key
- The key to override.value
- The value.getSerializationProperty(Object)
public void removeSerializationProperty(java.lang.Object key)
setSerializationProperty(Object,Object)
serialization property.
key
- The key for which the local property override should be removed.setSerializationProperty(Object, Object)
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |