protected void setUp() throws Exception { factory = new SimpleFeaturePropertyAccessorFactory(); }
public void test() { // make sure features are supported assertNotNull(factory.createPropertyAccessor(SimpleFeature.class, "xpath", null, null)); assertNotNull(factory.createPropertyAccessor(SimpleFeatureType.class, "xpath", null, null)); assertNull(factory.createPropertyAccessor(Map.class, "xpath", null, null)); // make sure only simple xpath assertNull(factory.createPropertyAccessor(SimpleFeature.class, "@xpath", null, null)); assertNull(factory.createPropertyAccessor(SimpleFeatureType.class, "@xpath", null, null)); assertNull(factory.createPropertyAccessor(SimpleFeature.class, "/xpath", null, null)); assertNull(factory.createPropertyAccessor(SimpleFeatureType.class, "/xpath", null, null)); assertNull(factory.createPropertyAccessor(SimpleFeature.class, "*[0]", null, null)); assertNull(factory.createPropertyAccessor(SimpleFeatureType.class, "*[0]", null, null)); assertNull(factory.createPropertyAccessor(SimpleFeature.class, "===", null, null)); assertNull(factory.createPropertyAccessor(SimpleFeature.class, "34x?<>", null, null)); } }
public Object get(Object object, String xpath, Class target) { xpath = stripPrefixIndex(xpath); if (object instanceof SimpleFeature) { return ((SimpleFeature) object).getAttribute(xpath); } if (object instanceof SimpleFeatureType) { return ((SimpleFeatureType) object).getDescriptor(xpath); } return null; }
public Object get(Object object, String xpath, Class target) { xpath = stripPrefix(xpath); if ( object instanceof SimpleFeature ) { return ((SimpleFeature) object).getAttribute( xpath ); } if ( object instanceof SimpleFeatureType ) { return ((SimpleFeatureType) object).getDescriptor( xpath ); } return null; }
public void set(Object object, String xpath, Object value, Class target) throws IllegalAttributeException { xpath = stripPrefix(xpath); if ( object instanceof SimpleFeature ) { ((SimpleFeature) object).setAttribute( xpath, value ); } if ( object instanceof SimpleFeatureType ) { throw new IllegalAttributeException("feature type is immutable"); } } }
public Object get(Object object, String xpath, Class target) { xpath = stripPrefix(xpath); if ( object instanceof Feature ) { return ((Feature) object).getAttribute( xpath ); } if ( object instanceof FeatureType ) { return ((FeatureType) object).getAttributeType( xpath ); } return null; }
public void set(Object object, String xpath, Object value, Class target) throws IllegalAttributeException { xpath = stripPrefixIndex(xpath); if (object instanceof SimpleFeature) { ((SimpleFeature) object).setAttribute(xpath, value); } if (object instanceof SimpleFeatureType) { throw new IllegalAttributeException("feature type is immutable"); } } }
public void set(Object object, String xpath, Object value, Class target) throws IllegalAttributeException { xpath = stripPrefix(xpath); if ( object instanceof Feature ) { ((Feature) object).setAttribute( xpath, value ); } if ( object instanceof FeatureType ) { throw new IllegalAttributeException("feature type is immutable"); } } }
public boolean canHandle(Object object, String xpath, Class target) { xpath = stripPrefixIndex(xpath); if (object instanceof SimpleFeature) { return ((SimpleFeature) object).getType().getDescriptor(xpath) != null; } if (object instanceof SimpleFeatureType) { return ((SimpleFeatureType) object).getDescriptor(xpath) != null; } return false; }
public boolean canHandle(Object object, String xpath, Class target) { xpath = stripPrefix(xpath); if ( object instanceof Feature ) { return ((Feature) object).getAttribute( xpath ) != null; } if ( object instanceof FeatureType ) { return ((FeatureType) object).getAttributeType( xpath ) != null; } return false; }
public boolean canHandle(Object object, String xpath, Class target) { xpath = stripPrefix(xpath); if ( object instanceof SimpleFeature ) { return ((SimpleFeature) object).getType().getDescriptor(xpath) != null; } if ( object instanceof SimpleFeatureType ) { return ((SimpleFeatureType) object).getDescriptor( xpath ) != null; } return false; }