case TIME:
return java.sql.Time.valueOf(value);
case TIMESTAMP:
return new java.sql.Timestamp(new SimpleDateFormat().parse(value).getTime());
case POINT:
geom = new WKTReader2().read(value);
if (geom instanceof Point) {
return (Point) geom;
}
break;
case LINESTRING:
geom = new WKTReader2().read(value);
if (geom instanceof LineString) {
return (LineString) geom;
}
break;
case POLYGON:
geom = new WKTReader2().read(value);
if (geom instanceof Polygon) {
return (Polygon) geom;
}
break;
case MULTIPOINT:
geom = new WKTReader2().read(value);
if (geom instanceof MultiPoint) {
return (MultiPoint) geom;
}
break;
case MULTILINESTRING:
geom = new WKTReader2().read(value);
if (geom instanceof MultiLineString) {
return (MultiLineString) geom;
}
break;
case MULTIPOLYGON:
geom = new WKTReader2().read(value);
if (geom instanceof MultiPolygon) {
return (MultiPolygon) geom;
}
break;
case GEOMETRYCOLLECTION:
geom = new WKTReader2().read(value);
if (geom instanceof GeometryCollection) {
return (GeometryCollection) geom;
}
break;
case GEOMETRY:
return new WKTReader2().read(value);
default:
break;
}
throw new IOException();
}