|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.io.graphml.output.AbstractSerializer com.yworks.yfiles.server.graphml.flexio.serializer.ReflectionBasedSerializer com.yworks.yfiles.server.graphml.flexio.serializer.ExtensionBasedSerializer
Serializer implementation that produces output through the use of a MarkupExtension
.
The target object is first converted to a MarkupExtension
, which then gets serialized with the usual
serialization mechanism (usually through ReflectionBasedSerializer
.
To declare a type as serializable with a markup extension, a TypeConverter
that is able to convert the type into a MarkupExtension
has to be registered
with the type converter registry
.
Constructor Summary | |
ExtensionBasedSerializer()
|
Method Summary | |
boolean |
canHandle(SerializationEvent e)
Predicate member method to determine whether this instance should react to a given SerializationEvent .
|
protected java.lang.String |
getPropertyName(GraphMLWriteContext context,
java.beans.PropertyDescriptor property)
Returns the string that should be used for the attribute or child element when a property is serialized. |
protected java.lang.String |
getTagName(GraphMLWriteContext context,
java.lang.Object object)
|
void |
serializeItem(java.lang.Object object,
XmlWriter writer,
GraphMLWriteContext context)
The namespace for the serialized object consists of the symbolic package name as registered in the SymbolicPackageNameRegistry for the package of this object's class. |
Methods inherited from class com.yworks.yfiles.server.graphml.flexio.serializer.ReflectionBasedSerializer |
getNamespace, isCollectionProperty, serializeContent |
Methods inherited from class y.io.graphml.output.AbstractSerializer |
onHandleSerialization |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ExtensionBasedSerializer()
Method Detail |
public boolean canHandle(SerializationEvent e)
ReflectionBasedSerializer
SerializationEvent
.
Checks if the package of the class of the item in the event is registered in the SymbolicPackageNameRegistry
.
canHandle
in class ReflectionBasedSerializer
e
- The event data.
true
iff this instance should handle the event.public void serializeItem(java.lang.Object object, XmlWriter writer, GraphMLWriteContext context) throws GraphMLWriteException
ReflectionBasedSerializer
The namespace for the serialized object consists of the symbolic package name as registered in the
SymbolicPackageNameRegistry
for the package of this object's class.
ITypeConverter
for the object's type registered in TypeConverters
which
can convert the object into a String
, this String
representation is written as text
child node.
Otherwise all public read- and writable properties of the object are added to the xml node.
If an appropriate ITypeConverter
can be found via TypeConverters.getTypeConverter
which can convert a property into a String
, this property is written as an attributes of the
resulting xml node. Otherwise it is written as a child node of the resulting xml node using an appropriate
looked up serializer.
serializeItem
in class ReflectionBasedSerializer
GraphMLWriteException
TypeConverters
,
ITypeConverter
,
SymbolicPackageNameRegistry
protected java.lang.String getTagName(GraphMLWriteContext context, java.lang.Object object)
getTagName
in class ReflectionBasedSerializer
protected java.lang.String getPropertyName(GraphMLWriteContext context, java.beans.PropertyDescriptor property)
ReflectionBasedSerializer
getPropertyName
in class ReflectionBasedSerializer
context
- The current write contextproperty
- A property of the object that is currently being serialized.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |