public Object getImmediateNode() { return featureType.getAttribute(index); }
public String[] getPropertyNames(Object object) { SimpleFeature feature = (SimpleFeature) object; SimpleFeatureType featureType = feature.getFeatureType(); //set is ok because jxpath ignores order String[] propertyNames = new String[featureType.getAttributeCount()]; for (int i = 0; i < propertyNames.length; i++) { propertyNames[i] = featureType.getAttribute(i).getLocalName(); } return propertyNames; }
public static SimpleFeature feature(SimpleFeatureType fType, String fid, Node node) throws Exception { SimpleFeatureBuilder b = new SimpleFeatureBuilder(fType); Object[] attributes = new Object[fType.getAttributeCount()]; for (int i = 0; i < fType.getAttributeCount(); i++) { AttributeDescriptor att = fType.getAttribute(i); AttributeType attType = att.getType(); Object attValue = node.getChildValue(att.getLocalName()); if ((attValue != null) && !attType.getBinding().isAssignableFrom(attValue.getClass())) { //type mismatch, to try convert Object converted = Converters.convert(attValue, attType.getBinding()); if (converted != null) { attValue = converted; } } b.add(attValue); } //create the feature return b.buildFeature(fid); }
/** * Returns the qname with prefix as <code>null</code>, and local part the name of the * feature attribute. */ public QName getName() { return new QName(null, featureType.getAttribute(index).getLocalName()); }
public Object getProperty(Object object, QName name) throws Exception { SimpleFeature feature = (SimpleFeature) object; //JD: here we only handle the "GML" attributes, all the application // schema attributes are handled by FeaturePropertyExtractor //JD: TODO: handle all properties here and kill FeautrePropertyExtractor if (GML.name.equals(name)) { return feature.getAttribute("name"); } if (GML.description.equals(name)) { return feature.getAttribute("description"); } if (GML.location.equals(name)) { return feature.getAttribute("location"); } if (GML.boundedBy.equals(name)) { return feature.getBounds(); } if (feature.getFeatureType().getAttribute(name.getLocalPart()) != null) { return feature.getAttribute(name.getLocalPart()); } return null; } }
/** * Returns the qname with prefix as <code>null</code>, and local part the name of the * feature attribute. */ public QName getName() { return (index != -1) ? new QName(null, feature.getFeatureType().getAttribute(index).getLocalName()) : new QName(null, "fid"); }
if (featureType.getAttribute(attribute.getName()) == null) { continue;