kevinweil/elephant-bird — pull request #217 by edrevo (2012-06-13 10:16:54+00:00)
Title: Adding TypedProtobufWritable class

Hi,

Here's some code to add polymorphic support (from `M extends Message` to `Message` and the other way around) to the ProtobufWritable. Since this requires saving the type M in the output, it has been implemented as a different class (`TypedProtobufWritable`). This class lets you do stuff like this:

```
for (TypedProtobufWritable value in values) {
Message message = value.get();
if (message instanceof MyProtocMessage1) {
MyProtocMessage1 protoc1 = (MyProtocMessage1) message;
// do something with the protoc1
}
}
```

The output penalty when using this class vs. ProtobufWritable is somewhere between 6-13% in a typical usage with LZO compression.

Any comments/feedback would be appreciated :)