// -------------
// Set-up the vtGeom
final VTGeometryEncoder vtGeom = new VTGeometryEncoder("the_geom", "Point", "4326");
// Set-up 2 virtual table parameters
final VTParameterEncoder vtParam1 = new VTParameterEncoder("high", "100000000", "^[\\d]+$");
final VTParameterEncoder vtParam2 = new VTParameterEncoder("low", "0", "^[\\d]+$");
// sql
String sql = "select gid, state_name, the_geom from pgstates where persons between %low% and %high% and state_abbr = '%state%'";
// set-up the virtual table
final GSVirtualTableEncoder vte = new GSVirtualTableEncoder();
vte.setName(nativeName);
vte.setSql(sql);
vte.addVirtualTableGeometry(vtGeom);
vte.addVirtualTableParameter(vtParam1);
vte.addVirtualTableParameter(vtParam2);
// modif the vte
vte.delVirtualTableGeometry("the_geom");
vte.addVirtualTableGeometry("the_geom", "MultiPolygon", "4326");
final VTParameterEncoder vtParam3 = new VTParameterEncoder("state", "FL", "^[\\w\\d\\s]+$");
vte.addVirtualTableParameter(vtParam3);
vte.addKeyColumn("gid");
fte.setMetadataVirtualTable(vte); // Set the virtual table