/** * Given a field type, return the wire type. * * @returns One of the {@code WIRETYPE_} constants defined in {@link WireFormat}. */ static int getWireFormatForFieldType(final WireFormat.FieldType type, boolean isPacked) { if (isPacked) { return WireFormat.WIRETYPE_LENGTH_DELIMITED; } else { return type.getWireType(); } }