Source:
private static ThriftField toThriftField(String name, Field field, ThriftField.Requirement requirement) { ThriftType type; switch (ThriftTypeID.fromByte(field.getType())) { case STOP: case VOID: default: throw new UnsupportedOperationException("can't convert type of " + field); case BOOL: type = new BoolType(); break; case BYTE: type = new ByteType(); break; case DOUBLE: type = new DoubleType(); break; case I16: type = new I16Type(); break; case I32: type = new I32Type(); break; case I64: type = new I64Type(); break; case STRING: type = new StringType(); if (field.getFieldMetaData() != null && field.getFieldMetaData().valueMetaData.isBinary()) { ((StringType) type).setBinary(true); } break; case STRUCT: type = toStructType(field.gettStructDescriptor()); break; case MAP: final Field mapKeyField = field.getMapKeyField(); final Field mapValueField = field.getMapValueField(); type = new ThriftType.MapType( toThriftField(mapKeyField.getName(), mapKeyField, requirement), toThriftField(mapValueField.getName(), mapValueField, requirement)); break; case SET: final Field setElemField = field.getSetElemField(); type = new ThriftType.SetType(toThriftField(setElemField.getName(), setElemField, requirement)); break; case LIST: final Field listElemField = field.getListElemField(); type = new ThriftType.ListType(toThriftField(listElemField.getName(), listElemField, requirement)); break; case ENUM: Collection<TEnum> enumValues = field.getEnumValues(); List<EnumValue> values = new ArrayList<ThriftType.EnumValue>(); for (TEnum tEnum : enumValues) { values.add(new EnumValue(tEnum.getValue(), tEnum.toString())); } type = new EnumType(values); break; } return new ThriftField(name, field.getId(), requirement, type); }

Target:
private static ThriftField toThriftField(String name, Field field, ThriftField.Requirement requirement) { ThriftType type; switch (ThriftTypeID.fromByte(field.getType())) { case STOP: case VOID: default: throw new UnsupportedOperationException("can't convert type of " + field); case BOOL: type = new BoolType(); break; case BYTE: type = new ByteType(); break; case DOUBLE: type = new DoubleType(); break; case I16: type = new I16Type(); break; case I32: type = new I32Type(); break; case I64: type = new I64Type(); break; case STRING: StringType stringType = new StringType(); FieldMetaData fieldMetaData = field.getFieldMetaData(); if (fieldMetaData != null && fieldMetaData.valueMetaData.isBinary()) { stringType.setBinary(true); } type = stringType; break; case STRUCT: type = toStructType(field.gettStructDescriptor()); break; case MAP: final Field mapKeyField = field.getMapKeyField(); final Field mapValueField = field.getMapValueField(); type = new ThriftType.MapType( toThriftField(mapKeyField.getName(), mapKeyField, requirement), toThriftField(mapValueField.getName(), mapValueField, requirement)); break; case SET: final Field setElemField = field.getSetElemField(); type = new ThriftType.SetType(toThriftField(setElemField.getName(), setElemField, requirement)); break; case LIST: final Field listElemField = field.getListElemField(); type = new ThriftType.ListType(toThriftField(listElemField.getName(), listElemField, requirement)); break; case ENUM: Collection<TEnum> enumValues = field.getEnumValues(); List<EnumValue> values = new ArrayList<ThriftType.EnumValue>(); for (TEnum tEnum : enumValues) { values.add(new EnumValue(tEnum.getValue(), tEnum.toString())); } type = new EnumType(values); break; } return new ThriftField(name, field.getId(), requirement, type); }