I have a little problem with the class in which I am currently writing a save function.
I am using XStream (com.thoughtworks.xstream) to serialize a class in XML using DOMDriver.
The class is as follows:
public class World { private Configuration config; public World(Configuration config) { this.config = config; } }
So the problem here is that I donβt want to serialize the configuration when serializing the world, instead I would like to provide an XStream with a pre-configured configuration instance when calling fromXml ().
The problem here is mainly in class design. The configuration contains a personal reference to the GUI classes, and therefore serializing the configuration means serializing the entire application using the graphical interface, etc. And this is bad.
Is there a way to instruct XStream not to serialize the private field configuration, but to use the configuration instance when loading XStream?
greetings Daniel
java xstream
Tigraine
source share