BeanUtils.cloneBean() deep copy

hop picture hop · Feb 13, 2012 · Viewed 40.4k times · Source

If all the objects within the bean implement Serializable interface, will BeanUtils.cloneBean() do a deep copy?

Answer

Vikas Chowdhury picture Vikas Chowdhury · Nov 6, 2012

Use SerializationUtils.clone method from the Apache Commons Lang for the deep copy. It copies the entire class hierarchy.

SerializationUtils.clone(object);