I've got a complex object which is being managed by the LCDS DataServices data management and being created/updated etc using custom assemblers. The vast majority of the object hierarchy is being serialized/deserialized correctly but I've hit a stumbling block when it comes to serializing immutable java classes.
In a java only world I would use the java writeReplace and readResolve methods as this excellent blog describes: http://lingpipe-blog.com/2009/08/10/serializing-immutable-singletons-serialization-proxy/
This is how I originally wrote my java class, expecting livecycle to call the writeReplace method and duly replace the immutable class with a mutable one for serialization. However it would appear that lcds knows nothing of the writeReplace method and will only call readExternal/writeExternal ignoring readResolve and writeReplace.
Firstly, have other people found this to be the case, or am I missing something?
Secondly, has anyone come up with an appropriate method to deserialize actionscript classes into either immutable objects or singletons?
Many thanks
Yes, it's a common problem. Adobe recommend that the Java type that has immutable properties implements Externalizable and the equivalent ActionScript type implements IExternalizable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With