class GeometryFunctions {

    @DescribeProcess(title = "Polygonize", description = "Creates a set of polygons from linestrings delineating them.  The linestrings must be corrctly noded (i.e. touch only at endpoints).")
    @DescribeResult(description = "The collection of created polygons")
    static public Geometry polygonize(
            @DescribeParameter(name = "geom", description = "Linework to polygonize") Geometry geom) {
        @SuppressWarnings("rawtypes")
        List lines = LineStringExtracter.getLines(geom);
        Polygonizer polygonizer = new Polygonizer();
        polygonizer.add(lines);
        @SuppressWarnings("rawtypes")
        Collection polys = polygonizer.getPolygons();
        Polygon[] polyArray = GeometryFactory.toPolygonArray(polys);
        return geom.getFactory().createGeometryCollection(polyArray);
    }

}