Better support for types implementing Externalizable

Adds macro for generating ObjectInput instances.