Thursday, August 14, 2014

How to quickily clone an object in java

To quickly clone an java object, including all the children and relationships.
may consider to use SerializationUtils in Apache Commons Lang.

it's just easy with  1 line of code

MyObject newObject = (MyObject) SerializationUtils.clone(objectToClone);


Done!!

No comments:

Post a Comment

LinkWithin

Related Posts Plugin for WordPress, Blogger...