Is there an implementation that will serialize a Java object as Java code? For example, if I have the object
Map m = new Map
The pre-release of Long Term Persistence (java.beans.Encoder and friends) had both an XMLEncoder and a Java encoder. You can probably still download it somewhere.