in core/src/main/java/com/twitter/elephantbird/util/ThriftToProto.java [79:97]
private boolean typesMatch(FieldDescriptor protoFieldDesc, FieldValueMetaData thriftMetadata) {
if (thriftMetadata.isStruct()) {
// TODO: Handle structs
return false;
}
byte thriftType = thriftMetadata.type;
// TODO: Handle Lists that are more than 1 level deep. Be all pro-style with the recursion.
if (thriftMetadata.type == TType.LIST && protoFieldDesc.isRepeated()) {
FieldValueMetaData listMeta = ((ListMetaData) thriftMetadata).elemMetaData;
if (listMeta.isStruct() || listMeta.isContainer()) {
return false;
}
thriftType = listMeta.type;
}
return (protoFieldDesc.getType().equals(thriftTypeToProtoType(thriftType)) ||
thriftBinSucks(protoFieldDesc.getType(), thriftType));
}