I'm trying to use XMLEncoder
to write an object graph (tree in my case) to a file. However, one class contained in it is not actually a Java bean and I don't particularly like making its guts publicly accessible. It's accessed more like a list and has appropriate add
/remove
methods.
I've already written a custom PersistenceDelegate
to deal with that. However, it seems that I have to add the PersistenceDelegate
to the XMLEncoder
instance manually.
Is there any way for XMLEncoder
to pick it up on its own or do I really need to add it whenever I use an encoder to write a graph that may contain said class?