code: public void convertToLine() throws IllegalArgumentException {
          EGeometryType geometryType = EGeometryType.forGeometry(getGeometry());
          switch( geometryType ) {
          case MULTIPOLYGON:
          case POLYGON:
              // convert to line
              Coordinate[] tmpCoords = geometry.getCoordinates();
              geometry = GeometryUtilities.gf().createLineString(tmpCoords);
              // reset prepared geometry
              preparedGeometry = null;
              break;
          case LINESTRING:
          case MULTILINESTRING:
              // do nothing, is already line
              break;
          default:
              throw new IllegalArgumentException("Points not supported");
          }
      }
docs: Tries to convert the internal geometry to a {@link LineString}.
  
  <p>This works only for Polygon and Lines features.
  <p>From this moment on the internal geometry (as got by the {@link #getGeometry()})
  will be the line type.
  <p>To get the original geometry one can simply call {@link #resetGeometry()}.
  
  @throws IllegalArgumentException in the case the geometry is a point.