PropertyAccessors.findPropertyAccessors(obj, attPath, target, hints);
private PropertyAccessor getPropertyAccessor(Object obj, Class target) { if(lastAccessor == null) lastAccessor = PropertyAccessors.findPropertyAccessor( obj, attPath, target, hints ); else if(!lastAccessor.canHandle(obj, attPath, target)) lastAccessor = PropertyAccessors.findPropertyAccessor( obj, attPath, target, hints ); return lastAccessor; }
private ExtraDataPropertyAccesor findPropertyAccessor(Object object) { String xpath = "int"; Class target = Integer.class; Hints hints = null; List<PropertyAccessor> accessors = PropertyAccessors.findPropertyAccessors(object, xpath, target, hints); for (PropertyAccessor pa : accessors) { if (pa instanceof ExtraDataPropertyAccessorFactory.ExtraDataPropertyAccesor) { return (ExtraDataPropertyAccesor) pa; } } fail(ExtraDataPropertyAccessorFactory.ExtraDataPropertyAccesor.class.getName() + " not found: " + accessors); return null; }
/** * Gets the value of this attribute from the passed feature. * * @param feature Feature from which to extract attribute value. */ public Object evaluate(Feature feature) { PropertyAccessor accessor = PropertyAccessors.findPropertyAccessor( feature, attPath, null, null ); if ( accessor == null ) { //JD:not throwing exception to remain backwards compatabile, just returnign null return null; // throw new IllegalArgumentException( // "Could not find property accessor for: (" + feature + "," + attPath + ")" // ); } return accessor.get( feature, attPath, null ); //return feature.getAttribute(attPath); }
private ExtraDataPropertyAccesor findPropertyAccessor(Object object) { String xpath = "int"; Class target = Integer.class; Hints hints = null; List<PropertyAccessor> accessors = PropertyAccessors.findPropertyAccessors(object, xpath, target, hints); for (PropertyAccessor pa : accessors) { if (pa instanceof ExtraDataPropertyAccessorFactory.ExtraDataPropertyAccesor) { return (ExtraDataPropertyAccesor) pa; } } fail(ExtraDataPropertyAccessorFactory.ExtraDataPropertyAccesor.class.getName() + " not found: " + accessors); return null; }
/** * Determines whether or not the given feature's ID matches this filter. * <p> * In order to get the object's ID, the {@link PropertyAccessor} capable of * dealing with <code>feature</code> has to support the request of the * expression <code>"@id"</code> * </p> * * @param feature * Specified feature to examine. * * @return <tt>true</tt> if the feature's ID matches an fid held by this * filter, <tt>false</tt> otherwise. * @see SimpleFeaturePropertyAccessorFactory */ public boolean evaluate(Object feature) { if (feature == null) { return false; } final Set fids = fids(); final String attPath = "@id"; PropertyAccessor accessor = PropertyAccessors.findPropertyAccessor(feature, attPath, null, null); if (accessor == null) { return false; } Object id = accessor.get(feature, attPath, null); return fids.contains(id); }
hints = new Hints(PropertyAccessorFactory.NAMESPACE_CONTEXT, namespaceSupport); List<PropertyAccessor> accessors = PropertyAccessors.findPropertyAccessors(obj, attPath, target, hints );