Is it possible to convert a plain Java Object with the usual getXXX and setXXX methods for its fields to a key-value pair, like Map<String, Object>?
I need to to this without relying on Java reflection, so it can be used with a Java-To-Javascript compiler like GWT.
I’ve done this before by using a MapSerialisation interface:
Implement that on each of your model objects and use that for translation.
Another method I’ve used is Google Collections’ Transformers, and having model transformation functions to convert between a Java object and a structure that Javascript would like.
I’d probably be tempted to use Jackson to serialise into JSON though.