}
/** {@inheritDoc} */
@Override
public synchronized <T> byte[] encode(final T cellValue) throws IOException {
final AbstractMessage message = (AbstractMessage) cellValue;
if (mProtoClass != message.getClass()) {
throw new IOException(String.format(
"Protocol buffer of class '%s' (message name '%s') "
+ "does not match expected class '%s' (message name '%s'): %s.",
cellValue.getClass().getName(), message.getDescriptorForType().getFullName(),
mProtoClass.getName(), mProtobufFullName,
cellValue));
}
return message.toByteArray();
}