code: public SimpleFeature convertDwgPolyline2D( String typeName, String layerName,
              DwgPolyline2D polyline2d, int id ) {
          Point2D[] ptos = polyline2d.getPts();
          CoordinateList coordList = new CoordinateList();
          if (ptos != null) {
              for( int j = 0; j < ptos.length; j++ ) {
                  Coordinate coord = new Coordinate(ptos[j].getX(), ptos[j].getY(), 0.0);
                  coordList.add(coord);
              }
  
              SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
              b.setName(typeName);
              b.setCRS(crs);
              b.add(THE_GEOM, LineString.class);
              b.add(LAYER, String.class);
              SimpleFeatureType type = b.buildFeatureType();
              SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
              Geometry lineString = gF.createLineString(coordList.toCoordinateArray());
              Object[] values = new Object[]{lineString, layerName};
              builder.addAll(values);
              return builder.buildFeature(typeName + "." + id);
          }
          return null;
      }
docs: Builds a line feature from a dwg polyline 2D.