To quickly clone an java object, including all the children and relationships, use SerializationUtils in Apache Commons Lang:
MyObject newObject = (MyObject) SerializationUtils.clone(objectToClone);
(http://www.kianworknotes.com/2014/08/how-to-quickily-clone-object-in-java.html)
No comments:
Post a Comment