We recently encountered a bug in our software where we were copying annotations. Changes made to the copy of the annotations would also be made on the original documents. This is because we were simply moving around the references of the object rather than making actual copies. When I looked into the code, it looked like it would be somewhat tedious to clone the object at its full depth. I then wondered if I could use Serialization to perform a deep copy. After some searching I found the exact article I was looking for. You can indeed use Serialization for this purpose and it works beautifully.
- Alex
See also Commons-Lang SerialisationUtils
http://jakarta.apache.org/commons/lang/
Posted by: Stephen Colebourne | September 29, 2006 at 07:57 AM