@Test public void testBuildFeatureType() { String input = CSVTestStrategySupport.buildInputString("quux,morx\n"); CSVFileState fileState = new CSVFileState(input, "foo"); CSVStrategy strategy = new CSVSpecifiedWKTStrategy(fileState, "quux"); SimpleFeatureType featureType = strategy.getFeatureType(); assertEquals("Invalid attribute count", 2, featureType.getAttributeCount()); GeometryDescriptor geometryDescriptor = featureType.getGeometryDescriptor(); assertEquals("Invalid geometry attribute name", "quux", geometryDescriptor.getLocalName()); }
@Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder featureBuilder = createBuilder(csvFileState); AttributeDescriptor descriptor = featureBuilder.get(wktField); if (descriptor != null) { AttributeTypeBuilder attributeBuilder = new AttributeTypeBuilder(); attributeBuilder.init(descriptor); attributeBuilder.setCRS(csvFileState.getCrs()); attributeBuilder.binding(Geometry.class); AttributeDescriptor modified = attributeBuilder.buildDescriptor(wktField); featureBuilder.set(modified); } return featureBuilder.buildFeatureType(); }
CSVSpecifiedWKTStrategy extends CSVStrategy { @Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder featureBuilder = createBuilder(csvFileState); AttributeDescriptor descriptor = featureBuilder.get(wktField); if (descriptor != null) { AttributeTypeBuilder attributeBuilder = new AttributeTypeBuilder(); attributeBuilder.init(descriptor); attributeBuilder.setCRS(csvFileState.getCrs()); attributeBuilder.binding(Geometry.class); AttributeDescriptor modified = attributeBuilder.buildDescriptor(wktField); featureBuilder.set(modified); } return featureBuilder.buildFeatureType(); } }
CSVSpecifiedWKTStrategy extends CSVStrategy { @Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder featureBuilder = createBuilder(csvFileState); AttributeDescriptor descriptor = featureBuilder.get(wktField); if (descriptor != null) { AttributeTypeBuilder attributeBuilder = new AttributeTypeBuilder(); attributeBuilder.init(descriptor); attributeBuilder.setCRS(csvFileState.getCrs()); attributeBuilder.binding(Geometry.class); AttributeDescriptor modified = attributeBuilder.buildDescriptor(wktField); featureBuilder.set(modified); } return featureBuilder.buildFeatureType(); } CSVSpecifiedWKTStrategy(CSVFileState csvFileState, String wktField); }
CSVSpecifiedWKTStrategy extends CSVStrategy { @Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder featureBuilder = createBuilder(csvFileState); AttributeDescriptor descriptor = featureBuilder.get(wktField); if (descriptor != null) { AttributeTypeBuilder attributeBuilder = new AttributeTypeBuilder(); attributeBuilder.init(descriptor); attributeBuilder.setCRS(csvFileState.getCrs()); attributeBuilder.binding(Geometry.class); AttributeDescriptor modified = attributeBuilder.buildDescriptor(wktField); featureBuilder.set(modified); } return featureBuilder.buildFeatureType(); } CSVSpecifiedWKTStrategy(CSVFileState csvFileState, String wktField); @Override void createSchema(SimpleFeatureType featureType); @Override String[] encode(SimpleFeature feature); @Override SimpleFeature decode(String recordId, String[] csvRecord); }
CSVSpecifiedWKTStrategy extends CSVStrategy { @Override protected SimpleFeatureType buildFeatureType() { SimpleFeatureTypeBuilder featureBuilder = createBuilder(csvFileState); AttributeDescriptor descriptor = featureBuilder.get(wktField); if (descriptor != null) { AttributeTypeBuilder attributeBuilder = new AttributeTypeBuilder(); attributeBuilder.init(descriptor); attributeBuilder.setCRS(csvFileState.getCrs()); attributeBuilder.binding(Geometry.class); AttributeDescriptor modified = attributeBuilder.buildDescriptor(wktField); featureBuilder.set(modified); } return featureBuilder.buildFeatureType(); } CSVSpecifiedWKTStrategy(CSVFileState csvFileState, String wktField); @Override void createSchema(SimpleFeatureType featureType); @Override String[] encode(SimpleFeature feature); @Override SimpleFeature decode(String recordId, String[] csvRecord);  }