java_gen: add support for object hashing via the guava hash API

Reviewer: @vaterlaus