Implementation of custom object id resolution.

This is related to #176, with a larger scope than what was suggested. It handles all resolution of ID with a new interface, `ObjectIdResolver`, which is basically the deserialization twin of `ObjectIdGenerator`.