|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.io.graphml.input.AbstractDeserializer com.yworks.yfiles.server.graphml.flexio.deserializer.ReflectionBasedDeserializer
This deserializer can be used to deserialize objects of different class types based on reflection.
A target class to which an XML
node shall be deserialized this way has to:
XML
nodeXML
node mapped to its package in the
SymbolicPackageNameRegistry
XML
node
This class also handles deserialization of IEnum
implementations.
SymbolicPackageNameRegistry
Constructor Summary | |
ReflectionBasedDeserializer()
|
Method Summary | |
boolean |
canHandle(DeserializationEvent e)
Node elements whose namespace uri is contained in the SymbolicPackageNameRegistry and for
which an instance can be created can be handled. |
protected java.lang.Object |
createInstance(org.w3c.dom.Node xmlNode)
Returns a new instance of the object the XML node shall be deserialized to. |
java.lang.Object |
deserializeNode(org.w3c.dom.Node xmlNode,
GraphMLParseContext context)
The namespace URI of the xml node to deserialize has to be mapped to the package of the target class in the SymbolicPackageNameRegistry .
|
protected java.lang.String |
getPropertyName(java.lang.String originalName)
|
Methods inherited from class y.io.graphml.input.AbstractDeserializer |
onHandleDeserialization |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ReflectionBasedDeserializer()
Method Detail |
public boolean canHandle(DeserializationEvent e)
SymbolicPackageNameRegistry
and for
which an instance can be created can be handled.
e
- The deserialization event to check.
true
if the namespace uri of the element's xmlNode is contained in the
SymbolicPackageNameRegistry
and an instance of the target class can be created.SymbolicPackageNameRegistry
,
createInstance(org.w3c.dom.Node)
public java.lang.Object deserializeNode(org.w3c.dom.Node xmlNode, GraphMLParseContext context) throws GraphMLParseException
The namespace URI of the xml node to deserialize has to be mapped to the package of the target class in the
SymbolicPackageNameRegistry
.
The node name has to map the name of this target class.
If there is an ITypeConverter
registered for the target class in TypeConverters
which
can convert from a String
, it is used to deserialize the String
returned by
xmlNode.getTextContent()
.
XML
element, the property type is looked
up via reflection.
For the attributes an appropriate ITypeConverter
for their class type is looked up via
TypeConverters.getTypeConverter
and used.
Child nodes are deserialized using an appropriate registered DeserializationHandler
.
GraphMLParseException
TypeConverters
,
ITypeConverter
,
SymbolicPackageNameRegistry
protected java.lang.Object createInstance(org.w3c.dom.Node xmlNode)
xmlNode
- The node to deserialize.
protected java.lang.String getPropertyName(java.lang.String originalName)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |