else if (reader.getNodeName().equals("type")) { Geometries geomType = Geometries.getForName(reader.getValue()); type = geomType == null ? Geometry.class : geomType.getBinding(); } else if (reader.getNodeName().equals("srid")) { srid = Converters.convert(reader.getValue(), Integer.class);
@Override public void registerClassToSqlMappings(Map<Class<?>, Integer> mappings) { super.registerClassToSqlMappings(mappings); // add geometry mappings for (Geometries g : Geometries.values()) { mappings.put(g.getBinding(), g.getSQLType()); } // override some internal defaults mappings.put(Long.class, Types.INTEGER); mappings.put(Double.class, Types.REAL); mappings.put(Boolean.class, Types.INTEGER); }
Geometries g = Geometries.getForName(t); if (g != null) { return g.getBinding();
Geometries g = Geometries.getForName(type); if (g != null) { return g.getBinding(); Geometries g = Geometries.getForName(remark); if (g != null) { return g.getBinding();
@Test public void testGetBinding() { // System.out.println(" getBinding"); assertEquals(Point.class, Geometries.POINT.getBinding()); assertEquals(MultiPoint.class, Geometries.MULTIPOINT.getBinding()); assertEquals(LineString.class, Geometries.LINESTRING.getBinding()); assertEquals(MultiLineString.class, Geometries.MULTILINESTRING.getBinding()); assertEquals(Polygon.class, Geometries.POLYGON.getBinding()); assertEquals(MultiPolygon.class, Geometries.MULTIPOLYGON.getBinding()); assertEquals(Geometry.class, Geometries.GEOMETRY.getBinding()); assertEquals(GeometryCollection.class, Geometries.GEOMETRYCOLLECTION.getBinding()); }
/** Tests getName and getSimpleName */ @Test public void testGetName() { // System.out.println(" getName and getSimpleName"); for (Geometries type : Geometries.values()) { String className = type.getBinding().getSimpleName(); assertTrue(type.getName().equalsIgnoreCase(className)); if (className.startsWith("Multi")) { assertTrue(type.getSimpleName().equalsIgnoreCase(className.substring(5))); } else { assertTrue(type.getSimpleName().equalsIgnoreCase(className)); } } }
private Class mapTypeName(String typeName) { // try xs simple type Schema xsTypeMappingProfile = XS.getInstance().getTypeMappingProfile(); NameImpl name = new NameImpl(XS.NAMESPACE, typeName); if (xsTypeMappingProfile.containsKey(name)) { AttributeType type = xsTypeMappingProfile.get(name); if (type.getBinding() != null) { return type.getBinding(); } } // try gml geometry types Geometries g = Geometries.getForName(typeName); if (g != null) { return g.getBinding(); } // default return String.class; } }
@Override public void registerClassToSqlMappings(Map<Class<?>, Integer> mappings) { super.registerClassToSqlMappings(mappings); mappings.put( Geometries.POINT.getBinding(), Geometries.POINT.getSQLType() ); mappings.put( Geometries.LINESTRING.getBinding(), Geometries.LINESTRING.getSQLType() ); mappings.put( Geometries.POLYGON.getBinding(), Geometries.POLYGON.getSQLType() ); mappings.put( Geometries.MULTIPOINT.getBinding(), Geometries.MULTIPOINT.getSQLType() ); mappings.put( Geometries.MULTILINESTRING.getBinding(), Geometries.MULTILINESTRING.getSQLType() ); mappings.put( Geometries.MULTIPOLYGON.getBinding(), Geometries.MULTIPOLYGON.getSQLType() ); mappings.put( Geometries.GEOMETRY.getBinding(), Geometries.GEOMETRY.getSQLType() ); mappings.put( Geometries.GEOMETRYCOLLECTION.getBinding(), Geometries.GEOMETRYCOLLECTION.getSQLType() ); //override some internal defaults mappings.put(Long.class, Types.INTEGER); mappings.put(Double.class, Types.REAL); }
@Override public void registerClassToSqlMappings(Map<Class<?>, Integer> mappings) { super.registerClassToSqlMappings(mappings); // add geometry mappings for (Geometries g : Geometries.values()) { mappings.put(g.getBinding(), g.getSQLType()); } // override some internal defaults mappings.put(Long.class, Types.INTEGER); mappings.put(Double.class, Types.REAL); mappings.put(Boolean.class, Types.INTEGER); }
Geometries g = Geometries.getForName(t); if (g != null) { return g.getBinding();
Geometries g = Geometries.getForName(type); if (g != null) { return g.getBinding(); Geometries g = Geometries.getForName(remark); if (g != null) { return g.getBinding();
if ( rs.next() ) { String type = rs.getString( "type" ); return Geometries.getForName( type ).getBinding();
private Class mapTypeName(String typeName) { //try xs simple type Schema xsTypeMappingProfile = XS.getInstance().getTypeMappingProfile(); NameImpl name = new NameImpl(XS.NAMESPACE, typeName); if (xsTypeMappingProfile.containsKey(name)) { AttributeType type = xsTypeMappingProfile.get(name); if (type.getBinding() != null) { return type.getBinding(); } } //try gml geometry types Geometries g = Geometries.getForName(typeName); if (g != null) { return g.getBinding(); } //default return String.class; }