docs: public static String getMappedWriteCode(FieldInfo field, String prefix, int order, FieldType type, boolean isList,
              boolean isMap) {
          String fieldName = getFieldName(order);
          StringBuilder ret = new StringBuilder();
          ret.append("if (").append(fieldName).append(" != null){").append(CodeGenerator.LINE_BREAK);
  
          if (isList) {
              String typeString = type.getType().toUpperCase();
              ret.append("CodedConstant.writeToList(").append(prefix).append(",");
              ret.append(order).append(",").append("FieldType.").append(typeString);
              ret.append(",").append(fieldName).append(",").append(Boolean.valueOf(field.isPacked())).append(")")
                      .append(CodeGenerator.JAVA_LINE_BREAK).append("}").append(CodeGenerator.LINE_BREAK);
              return ret.toString();
          } else if (isMap) {
              ret.append("CodedConstant.writeToMap(").append(prefix).append(",");
              ret.append(order).append(",").append(fieldName);
  
              String joinedSentence = getMapFieldGenericParameterString(field);
              ret.append(",").append(joinedSentence);
  
              ret.append(")").append(CodeGenerator.JAVA_LINE_BREAK).append("}").append(CodeGenerator.LINE_BREAK);
              return ret.toString();
  
          } else {
              // not list so should add convert to primitive type
              boolean enumSpecial = false;
              if (type == FieldType.ENUM) {
                  if (EnumReadable.class.isAssignableFrom(field.getField().getType())) {
                      String clsName = ClassHelper.getInternalName(field.getField().getType().getCanonicalName());
                      fieldName = "((" + clsName + ") " + fieldName + ").value()";
                      enumSpecial = true;
                  }
              }
              if (!enumSpecial) {
                  fieldName = fieldName + type.getToPrimitiveType();
              }
          }
  
          if (type == FieldType.OBJECT) {
              String typeString = type.getType().toUpperCase();
              ret.append("CodedConstant.writeObject(").append(prefix).append(",");
              ret.append(order).append(",").append("FieldType.").append(typeString);
              ret.append(",").append(fieldName).append(", false)").append(CodeGenerator.JAVA_LINE_BREAK).append("}")
                      .append(CodeGenerator.LINE_BREAK);
              return ret.toString();
          }
  
          if (type == FieldType.STRING || type == FieldType.BYTES) {
              ret.append(prefix).append(".writeBytes(").append(order);
              ret.append(", ").append(fieldName).append(")").append(CodeGenerator.JAVA_LINE_BREAK).append("}")
                      .append(CodeGenerator.LINE_BREAK);
              return ret.toString();
          }
          String t = type.getType();
          t = capitalize(t);
  
          ret.append(prefix).append(".write").append(t).append("(").append(order);
          ret.append(", ").append(fieldName).append(")").append(CodeGenerator.JAVA_LINE_BREAK).append("}")
                  .append(CodeGenerator.LINE_BREAK);
          return ret.toString();
      }