code: private void generateWriteToParcel(JavaWriter jw, String originClass,
        List<ParcelableField> fields) throws IOException {
  
      jw.beginMethod("void", "writeToParcel", EnumSet.of(Modifier.PUBLIC, Modifier.STATIC),
          originClass, PARAM_SOURCE, "Parcel", PARAM_PARCEL, "int", PARAM_FLAGS);
  
      for (ParcelableField field : fields) {
        FieldCodeGen gen = field.getCodeGenerator();
  
        if (gen == null) { // Already checked before, but let's check it again
          ProcessorMessage.error(field.getElement(),
              "The field %s is not Parcelable or of unsupported type. Use a @%s",
              field.getFieldName(),
              Bagger.class.getSimpleName() + " to provide your own serialisation mechanism");
  
          throw new IOException("Unparcelable Field " + field.getFieldName());
        }
  
        jw.emitEmptyLine();
        gen.generateWriteToParcel(field, jw);
      }
  
      jw.endMethod();
    }
docs: Generate the writeToParcel method
  
  @throws IOException