Hi, aA common problem is to store objects (with graph), and to load them back. This is easy as long the stored object representation matches the executing code. But as time goes by, requirements change and stored objects do not match any longer the code. The stored objects should not loose their data, and the code in the clients should work with the latest object-models. So
So a transformation has to occouroccur somehow between loading the data and returning a object to the client.
I know that there exist some libraries such as XStream, gson, protobuf and avro. They could load older objects, but afaik just ignore data that does not match any longer the fields in the class (maybe I missed something).
(When I'm talking about storing and serialization I do not mean Java's buildbuilt in serialization mechanism.)
- File-based - I want to be able to store the serialized object on disk
- Appendable - I want to append multiple objects to one file without loading the whole file in memory again and again
- Support for multiple versions in one file - A file could contain objects with different version (only of the same type)
- Transformation - Data should be accessible by using the same type, even when changed in between.
- Generic - The mechanism itself has to be generic, so I could use it for different objects (different objects do not get mixed in one file, only differntdifferent versions of one type).
Some pseudeocodepseudocode how the client might take use of this:
- The transformer have to work on some kind of intermediate format (could be the backed stored format such as json or xml)
- You don't know how the class format was at some point in time, since you're only tranformingtransforming relative to the previous version and mapping to the final class, making search for errors hard
- Performance (depending on how the transformation happens)
I hope that I could give an overview of the problem, otherwise please ask, I will update the question.