Take a look at com.wajam.mry.api.protobuf.ProtobufTranslator fromProtoValue (Uses pattern matching on getType)