4 ms·
To check I understand: you need to deserialize objects, and you also want to pass in some arguments to some of those objects, so that their initialization is ba
by 10ren 16y ago
To check I understand: you need to deserialize objects, and you also want to pass in some arguments to some of those objects, so that their initialization is based on both the serialized data and the arguments? Is that to do with currying (is currying in Ruby?) In a complex object graph, how do you know which arguments should go to which objects?
You could use a global object to hold these arguments (or, subclass Thread, and associate the data with that, and yield while the deserialization runs in that thread). Ugly, yes.
BTW: it is possible to set final fields outside a constructor, using some black hacking (by accessing the same hooks that JOS uses internally). A few serialization tools use this, and I recall a project that consisted entirely of providing nicer access to these hooks (I searched for it, but couldn't find it).