问题描述
我有它正在由LCDS DataService的数据管理管理,并正在创建/使用自定义装配更新等一个复杂的对象。对象层次的绝大多数是被序列化/反序列化正确的,但我已经打了一个绊脚石,当涉及到序列化不可改变的Java类。
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.
在一个Java唯一的世界我会使用java writeReplace和readResolve方法来为这个优秀的博客描述:http://lingpipe-blog.com/2009/08/10/serializing-immutable-singletons-serialization-proxy/
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/
这就是我最初写我的java类,预期的LiveCycle调用writeReplace方法,并正式与可变之一系列化替代不可变类。但是它会出现液晶显示器什么都不知道了writeReplace方法,只会叫的readExternal /的writeExternal忽视的readResolve和writeReplace。
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?
其次,有没有人想出一个适当的方法来反序列化ActionScript类成不可变对象或单身?
Secondly, has anyone come up with an appropriate method to deserialize actionscript classes into either immutable objects or singletons?
感谢
推荐答案
是的,这是一个普遍的问题。的Adobe建议有不可改变的属性为Java类型实现外部化和等效动作类型实现IExternalizable。
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.
这篇关于序列化不可改变的Java类动作与LCDS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!