code: public static GeometryCollection extrudePolygonAsGeometry(Polygon polygon, double height){
          GeometryFactory factory = polygon.getFactory();
          Geometry[] geometries = new Geometry[3];        
          //Extract floor
          //We process the exterior ring 
          final LineString shell = getClockWise(polygon.getExteriorRing());
          ArrayList<Polygon> walls = new ArrayList<Polygon>();
          for (int i = 1; i < shell.getNumPoints(); i++) {
              walls.add(extrudeEdge(shell.getCoordinateN(i - 1), shell.getCoordinateN(i), height, factory));
          }
  
          final int nbOfHoles = polygon.getNumInteriorRing();
          final LinearRing[] holes = new LinearRing[nbOfHoles];
          for (int i = 0; i < nbOfHoles; i++) {
              final LineString hole = getCounterClockWise(polygon.getInteriorRingN(i));
              for (int j = 1; j < hole.getNumPoints(); j++) {
                  walls.add(extrudeEdge(hole.getCoordinateN(j - 1),
                          hole.getCoordinateN(j), height, factory));
              }
              holes[i] = factory.createLinearRing(hole.getCoordinateSequence());            
          }
          
          geometries[0]= factory.createPolygon(factory.createLinearRing(shell.getCoordinateSequence()), holes);
          geometries[1]= factory.createMultiPolygon(walls.toArray(new Polygon[0]));
          geometries[2]= extractRoof(polygon, height);
          return polygon.getFactory().createGeometryCollection(geometries);
      }
docs: Extrude the polygon as a collection of geometries
  The output geometryCollection contains the floor, the walls and the roof.
  @param polygon
  @param height
  @return