Exemple #1
0
 /**
  * Create a feature with a number of data elements in the extended data. This method will not use
  * a schema.
  *
  * @param geoclass the class of the geometry objects to create
  * @param schema the schema
  * @param valuemap the valuemap, not <code>null</code>
  * @return the new instance
  */
 protected Feature createFeature(
     Class<? extends Geometry> geoclass, Schema schema, Map<String, Object> valuemap) {
   if (schema == null) {
     throw new IllegalArgumentException("schema should never be null");
   }
   if (valuemap == null) {
     throw new IllegalArgumentException("valuemap should never be null");
   }
   Feature f = createBasicFeature(geoclass);
   f.setSchema(schema.getId());
   for (String key : schema.getKeys()) {
     SimpleField field = schema.get(key);
     Object value = valuemap.get(key);
     f.putData(field, value != null ? value : ObjectUtils.NULL);
   }
   return f;
 }
Exemple #2
0
 /**
  * Create a feature with a number of data elements in the extended data. This method will not use
  * a schema.
  *
  * @param geoclass the class of the geometry objects to create
  * @param names the names of the attributes
  * @param values the values, the length must match the length of names
  * @return the new instance
  */
 protected Feature createFeature(
     Class<? extends Geometry> geoclass, String names[], Object values[]) {
   if (names == null) {
     throw new IllegalArgumentException("names should never be null");
   }
   if (values == null) {
     throw new IllegalArgumentException("values should never be null");
   }
   if (names.length != values.length) {
     throw new IllegalArgumentException("the count of names and values must match");
   }
   Feature f = createBasicFeature(geoclass);
   for (int i = 0; i < names.length; i++) {
     SimpleField field = new SimpleField(names[i]);
     f.putData(field, values[i]);
   }
   return f;
 }