Previously, when I want to deep copy an object, I have to ensure it implements clone(). Every time it only contains a bunch of properties copy. Of course it is performance consuming considering some complicated structrue, worse still, I have to take care of it when adding or removing properties. It is awkward and annoying.
Now when I started a new project from ground, I really want to get rid of this. And there it is!
I have used [b]ObjectUtil.copy() [/b]before, it does copy the object but also lose all the class info. So I thought it was used for Object only.
But the real story behind it is serializing and de-serializing.
So after adding the alias information, it completes its task perfectly. Let clone() go!
related link:
[url]http://blog.comtaste.com/2007/10/improving_object_copy.html[/url]
Now when I started a new project from ground, I really want to get rid of this. And there it is!
I have used [b]ObjectUtil.copy() [/b]before, it does copy the object but also lose all the class info. So I thought it was used for Object only.
But the real story behind it is serializing and de-serializing.
So after adding the alias information, it completes its task perfectly. Let clone() go!
related link:
[url]http://blog.comtaste.com/2007/10/improving_object_copy.html[/url]