splatch commented on a change in pull request #213:
URL: https://github.com/apache/plc4x/pull/213#discussion_r550367392
##########
File path:
plc4j/drivers/eip/src/main/java/org/apache/plc4x/java/eip/readwrite/field/EipField.java
##########
@@ -135,4 +138,27 @@ public String getPlcDataType() {
return Object.class;
}
}
+
+ @Override
+ public void xmlSerialize(Element parent) {
+ Document doc = parent.getOwnerDocument();
+ Element messageElement = doc.createElement(getClass().getSimpleName());
+ parent.appendChild(messageElement);
+
+ Element blockNumberElement = doc.createElement("node");
+ blockNumberElement.appendChild(doc.createTextNode(tag));
+ messageElement.appendChild(blockNumberElement);
+
+ Element indexElement = doc.createElement("type");
+ indexElement.appendChild(doc.createTextNode(type == null ? "" :
type.name()));
+ messageElement.appendChild(indexElement);
+
+ Element subIndexElement = doc.createElement("elementNb");
+
subIndexElement.appendChild(doc.createTextNode(Integer.toString(elementNb)));
+ messageElement.appendChild(subIndexElement);
+
+ Element dataType = doc.createElement("defaultJavaType");
+ dataType.appendChild(doc.createTextNode((type == null ? Object.class :
getDefaultJavaType()).getName()));
+ messageElement.appendChild(dataType);
+ }
Review comment:
This is regular implementation of `XmlSerializable` interface from plc4x
spi.utils package. It is based on regular dom api just like other places.
Overall issue is how to make this mapping automatic in xstream, am I right?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]