code: private Polygon parsePolygon(ValueGetter data, boolean haveZ, boolean haveM, int srid) {
          int holecount = data.getInt() - 1;
          LinearRing[] rings = new LinearRing[holecount];
          LinearRing shell = this.parseLinearRing(data, haveZ, haveM);
          shell.setSRID(srid);
  
          for(int i = 0; i < holecount; ++i) {
              rings[i] = this.parseLinearRing(data, haveZ, haveM);
              rings[i].setSRID(srid);
          }
  
          return JtsGeometry.geofac.createPolygon(shell, rings);
      }
docs: Parse the given {@link org.postgis.binary.ValueGetter} into a JTS
  {@link org.locationtech.jts.geom.Polygon}.
  
  @param data {@link org.postgis.binary.ValueGetter} to parse.
  @param haveZ True if the {@link org.locationtech.jts.geom.Polygon} has a Z component.
  @param haveM True if the {@link org.locationtech.jts.geom.Polygon} has a M component.
  
  @return The parsed {@link org.locationtech.jts.geom.Polygon}.