XStream uses reflection to discover the structure of the object graph to serialize at run time, and doesn't require modifications to objects. It can serialize internal fields, including private and final, and supports non-public and inner classes.1
When serializing an object it serializes the full object graph. Duplicate references encountered in the object-model will be maintained. For example, using the following class CD
and add some of these object to a list
If the above code is executed with XStream's default relative references mode, it will generate the following XML:
XStream is free software, distributed under a permissive, revised BSD-style licence.
"Use XStream to serialize Java objects into XML". Ibm.com. Archived from the original on February 19, 2009. Retrieved 2009-12-14. https://web.archive.org/web/20090219204439/http://www.ibm.com/developerworks/java/library/x-xstream/index.html? ↩
"XStream - References". Xstream.codehaus.org. Retrieved 2009-12-14. https://x-stream.github.io/references.html ↩