Consider the code below:
DummyBean dum = new DummyBean();
dum.setDummy(\"foo\");
System.out.println(dum.getDummy()); // prints \'foo\'
DummyBean dumtwo = du
You can deep copy automatically with XStream, from http://x-stream.github.io/:
XStream is a simple library to serialize objects to XML and back again.
Add it to your project (if using maven)
com.thoughtworks.xstream
xstream
1.3.1
Then
DummyBean dum = new DummyBean();
dum.setDummy("foo");
DummyBean dumCopy = (DummyBean) XSTREAM.fromXML(XSTREAM.toXML(dum));
With this you have a copy without the need to implement any cloning interface.