Hi guys,
I have a system that entities (from database, represented as Java objects through ORM) will be read by XML-RPC clients, my existing way is to serialize them via a StructSerializer
, which in its code, we read properties out from the Java object, including calling another StructSerializer
to serialize/parse a property, e.g.
Surrogate parse(Map<String, Object> in) {
String name = in.get(Surrogate.NAME, String.class);
...
}
Map<String, Object> serialize(Surrogate in) {
out.put(Surrogate.ID, in.getId());
out.put(Surrogate.USER, userSerializer.serialize(in.getUser()))
}
What I am looking now is to eliminate/automate/minimize writing such code. Also, XML-RPC-compatible is not really the issue.
Thanks a lot.
Edited:
To elaborate further, XML conversion is handled by Apache XML-RPC, all I need is to dump in a Map for it to work on. What I need now is a unified/well-accepted way to convert Java objects to Map.