code: public static void writeField(final FieldDescriptorLite<?> descriptor,
                                  final Object value,
                                  final CodedOutputStream output)
                                  throws IOException {
      WireFormat.FieldType type = descriptor.getLiteType();
      int number = descriptor.getNumber();
      if (descriptor.isRepeated()) {
        final List<?> valueList = (List<?>)value;
        if (descriptor.isPacked()) {
          output.writeTag(number, WireFormat.WIRETYPE_LENGTH_DELIMITED);
          // Compute the total data size so the length can be written.
          int dataSize = 0;
          for (final Object element : valueList) {
            dataSize += computeElementSizeNoTag(type, element);
          }
          output.writeRawVarint32(dataSize);
          // Write the data itself, without any tags.
          for (final Object element : valueList) {
            writeElementNoTag(output, type, element);
          }
        } else {
          for (final Object element : valueList) {
            writeElement(output, type, number, element);
          }
        }
      } else {
        if (value instanceof LazyField) {
          writeElement(output, type, number, ((LazyField) value).getValue());
        } else {
          writeElement(output, type, number, value);
        }
      }
    }
docs: Write a single field.