An example from our config , where objects reference other objects, here an object which has an id=Tree_topics, which is referenced by that id , in another object:
<freemindFile class="admingui.clientconfig.model.freemind.FreemindFilesManager$1" reference="4"></freemindFile>
<crossList class="linked-list" id="13">
<entitySet class=".admingui.clientconfig.model.entityset.EntitySetFromFreemind" reference="Tree_topics"></entitySet>
For us (and probably some other folks) it would have several advantages to use that user-defineable ID as reference, instead of the number!
- makes it possible to make the config human read- and understandable
- config can even be modified manually, inserting new objects with unique id's which do not break the existing config, like with incremental ID numbering
- also a lot nicer (and should be faster) than xpath references
Besides, first we had another crazy idea:
- Wouldn't it rock if one could serialize an object graph to a spring XML config !?
That is, the generated file should instantiate the same object graph, when loaded by a spring application context
Could this be done with XStream ?
I guess there are some issues making this idea illusional, but many of these could probably be handled.
This would allow to have the whole config only in Spring format, and not a mixture like we currently have when the more data centric objects are serialized with XStream.
This would also help following user (we having the same problem):
following posting maybe relevant for the wished Advanced XStream.ID_REFERENCES marshall Mode: