// A Funnel describes how to decompose a particular object type into primitive field values.// For example, if we hadcaseclass Person(id: Integer, firstName: String, lastName: String, birthYear: Int)
// our Funnel might look likeimplicitval personFunnel = new Funnel[Person] {
overridedef funnel(person: Person, into: PrimitiveSink) = {
into
.putInt(person.id)
.putString(person.firstName, Charsets.UTF_8)
.putString(person.lastName, Charsets.UTF_8)
.putInt(person.birthYear)
}
}
abstract deffunnel(from: T, into: PrimitiveSink): Unit
Sends a stream of data from the from object into the sink into.
Sends a stream of data from the from object into the sink into. There
is no requirement that this data be complete enough to fully reconstitute the object
later.
A
Funnel
is a type class for an object which can send data from an object of typeT
into aPrimitiveSink
.Note that serialization of a BloomFilter requires the proper serialization of funnels.
From the Guava Funnel tutorial:
0.6 (copied from Guava-libraries)