use of com.google.common.hash.Funnel in project GeoGig by boundlessgeo.
the class HashObject method _call.
/**
* Hashes a RevObject using a SHA1 hasher.
*
* @return a new ObjectId created from the hash of the RevObject.
*/
@Override
protected ObjectId _call() {
Preconditions.checkState(object != null, "Object has not been set.");
final Hasher hasher = ObjectId.HASH_FUNCTION.newHasher();
@SuppressWarnings("unchecked") final Funnel<RevObject> funnel = (Funnel<RevObject>) FUNNELS[object.getType().value()];
funnel.funnel(object, hasher);
final byte[] rawKey = hasher.hash().asBytes();
final ObjectId id = ObjectId.createNoClone(rawKey);
return id;
}