Jody Garnett ha scritto:
> Andrea Aime wrote:
>> Validation today occurs in two places:
>> * in feature building, when using SimpleFeatureBuilder
>> * in feature attribute change, since our features are mutable
>>   
> I kind of figure that the attribute change validation check should be an 
> implementation option; ie off by default. If you really want to have 
> this make use of a seperate FeatureFactory that performs such checks 
> StringFeatureFactory as it were.

Hum, in the current code, we don't have any feature factory,
the builder is doing all the work, validation included.
Which kind of makes sense from a performance point of view,
we do want to build a data structure and pass it as is to
the feature implementation without any extra data copying.

>> Shall we decide to have validation configurable, how
>> do we want it? Builder wise, we can simply add a
>> flag to the feature builder so that it will perform
>> validation during feature building, or not.
>>   
> Can this be done setting up the builder with either the 
> FeatureFactoryImpl or the StrictFeatureFactory. No need to get 
> complicated? Or is the builder performing more checks than could be 
> handled in the StrictFeatureFactory create methods?

As I said, it's actually doing all the work, no factory at all...
FeatureFactoryImpl is actually able to build a feature, but
it requires a List<Attribute> as parameter, which is nothing
short of atrocious performance wise. To have any chance of
getting to the same level of performance as 2.4.x the factory
_must_ grab an Object[] and not clone it, but use it directly
to build the simple feature.

>> Feature wise, the simplest approach could be to have validation off by 
>> default, and add an isValid() method to Feature or.
> I don't mind adding an isValid() method to Attribute - ie do that and it 
> will show up in Feature. But the implementation should be captured in a 
> common spot - say Types for GeoTools developers. Given that that this is 
> a good idea we "may" be able to leave it out of the GeoAPI interfaces? 

Sure... it's just quite hard to spot in my opinion. Feature.isValid()
is somethign that everybody can see with some code completion,
figuring out that validation is made in a class called Types
requires... reading the docs (imagination is not sufficient ;) )

Cheers
Andrea

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to