How to deal with serialization and deserialization of objects with dependencies -


suppose have 2 objects depend on each other or other objects(so use references these objects) , need save/restore "state" from/to disk. since storing pointers disk not produce correct results on restore, how keep dependencies correct on restore?

e.g.,

class {    b b; }  class b { {    a; } 

(or more complex chains may have n-cycles of dependencies)

a = deserialize(adata) b b = deserialize(bdata)

(and suppose need a.b = b , b.a = a)

i'm thinking having unique hashes objects lazy evaluation solve problem maybe there better ways? (if have unique hash easy find object use , save , restore object(basically hash acts pointer valid(since unique , never changes))


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -