code: public static GeometryCollection extrudeLineStringAsGeometry(LineString lineString, double height){
          Geometry[] geometries = new Geometry[3];        
          GeometryFactory factory = lineString.getFactory();
          //Extract the walls        
          Coordinate[] coords = lineString.getCoordinates();
          Polygon[] walls = new Polygon[coords.length - 1];
          for (int i = 0; i < coords.length - 1; i++) {
              walls[i] = extrudeEdge(coords[i], coords[i + 1], height, factory);
          }
          lineString.apply(new TranslateCoordinateSequenceFilter(0));
          geometries[0]= lineString;
          geometries[1]=  factory.createMultiPolygon(walls);        
          geometries[2]= extractRoof(lineString, height);
          return factory.createGeometryCollection(geometries);
      }
docs: Extrude the linestring as a collection of geometries
  The output geometryCollection contains the floor, the walls and the roof.
  @param lineString
  @param height
  @return