Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiple serialization depths?

 
Surasak Leenapongpanit
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an application relying on serialization for persistent storage. Specifically, the app should be able to serialize at 2 different "depths" meaning that a "quick save" saves/reads only high level information while a "full save" saves the entire serializable structure of the class.
Does anyone know if this is possible - and if so, any general implementation ideas?
Thanks.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi surasak
Can you give more details like what kind of information you have.
I am not able to visualize that you have one object and you want to partially serialize the state in 1st step and rest of it in 2nd step. Why one would need that?
Can we model this by breaking the single object into two separate objects- ToplevelInfo and WholeInfo (which contains ref to ToplevelInfo or extends it)? This way we can control serialization of two separately.
Also, we can implement Externalization in WholeInfo object and in its serializing methods read/write External just deal with the whole info as we already serialized ToplevelInfo in some previous step...
I hope I didn't missed your question.
Regards
Maulin
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you serialise an object all underlying data is serialised as well.
You would need to override the serialisation code to make it different.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic