Generic Deep Copy is a Java utility for deep copying objects (aka deep clone or deep cloning). The objects do not have to implement Serializable, Cloneable, or any other interface. Essentially, this utility deep copies any Java object. Using it can save time and energy in many cases.
- classes are non Serializable and they are from 3rd party jars so the source cannot be changed
- classes are non Serializable and there are hundreds of classes involved so updating them manually is time consuming
- researching Java reflection and deep copying versus shallow copying
- testing – create a copy, test changes to the object, create a new copy, test changes. To assure the changes are the same or to avoid having to reinitialize the primary instance.
Improving the utility is something to strive for so feedback is encouraged. If you download and try it please leave a comment! It’s the only way a wider variety of scenarios can be tested.