extension-spring5/src/main/java/com/alibaba/fastjson2/support/spring/data/mongodb/GeoJsonWriterModule.java [62:104]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) {
            if (object == null) {
                jsonWriter.writeNull();
                return;
            }

            GeoJsonPolygon polygon = (GeoJsonPolygon) object;
            if (jsonWriter.utf8) {
                jsonWriter.writeRaw(utf8Prefix);
            } else if (jsonWriter.utf16) {
                jsonWriter.writeRaw(charsPrefix);
            } else {
                jsonWriter.startObject();
                jsonWriter.writeName("type");
                jsonWriter.writeColon();
                jsonWriter.writeString("Point");

                jsonWriter.writeName("coordinates");
                jsonWriter.writeColon();
            }

            List<GeoJsonLineString> coordinates = polygon.getCoordinates();
            jsonWriter.startArray();
            for (int i = 0; i < coordinates.size(); i++) {
                if (i != 0) {
                    jsonWriter.writeComma();
                }
                GeoJsonLineString lineString = coordinates.get(i);
                jsonWriter.startArray();
                List<Point> points = lineString.getCoordinates();
                for (int j = 0; j < points.size(); j++) {
                    if (j != 0) {
                        jsonWriter.writeComma();
                    }
                    Point point = points.get(i);
                    jsonWriter.writeDoubleArray(point.getX(), point.getY());
                }
                jsonWriter.endArray();
            }
            jsonWriter.endArray();

            jsonWriter.endObject();
        }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



extension-spring6/src/main/java/com/alibaba/fastjson2/support/spring6/data/mongodb/GeoJsonWriterModule.java [62:104]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) {
            if (object == null) {
                jsonWriter.writeNull();
                return;
            }

            GeoJsonPolygon polygon = (GeoJsonPolygon) object;
            if (jsonWriter.utf8) {
                jsonWriter.writeRaw(utf8Prefix);
            } else if (jsonWriter.utf16) {
                jsonWriter.writeRaw(charsPrefix);
            } else {
                jsonWriter.startObject();
                jsonWriter.writeName("type");
                jsonWriter.writeColon();
                jsonWriter.writeString("Point");

                jsonWriter.writeName("coordinates");
                jsonWriter.writeColon();
            }

            List<GeoJsonLineString> coordinates = polygon.getCoordinates();
            jsonWriter.startArray();
            for (int i = 0; i < coordinates.size(); i++) {
                if (i != 0) {
                    jsonWriter.writeComma();
                }
                GeoJsonLineString lineString = coordinates.get(i);
                jsonWriter.startArray();
                List<Point> points = lineString.getCoordinates();
                for (int j = 0; j < points.size(); j++) {
                    if (j != 0) {
                        jsonWriter.writeComma();
                    }
                    Point point = points.get(i);
                    jsonWriter.writeDoubleArray(point.getX(), point.getY());
                }
                jsonWriter.endArray();
            }
            jsonWriter.endArray();

            jsonWriter.endObject();
        }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



