code: public static ResultSet createGridPoints(Connection connection, Value value, double deltaX, double deltaY) throws SQLException {
          if(value == null){
              return null;
          }
          if (value instanceof ValueString) {
              GridRowSet gridRowSet = new GridRowSet(connection, deltaX, deltaY, value.getString());
              gridRowSet.setCenterCell(true);
              return gridRowSet.getResultSet();
          } else if (value instanceof ValueGeometry) {
              ValueGeometry geom = (ValueGeometry) value;
              GridRowSet gridRowSet = new GridRowSet(connection, deltaX, deltaY, geom.getGeometry().getEnvelopeInternal());
              gridRowSet.setCenterCell(true);
              return gridRowSet.getResultSet();
          } else {
              throw new SQLException("This function supports only table name or geometry as first argument.");
          }
      }
docs: Create a regular grid of points using the first input value to compute
  the full extent.
  
  @param connection
  @param value could be the name of a table or a geometry.
  @param deltaX the X cell size
  @param deltaY the Y cell size
  @return a resultset that contains all cells as a set of polygons
  @throws SQLException