Hakim A ha scritto:
> Hello,
>
> When working with Feature attributes, we have to deal with Objects and
> cast them to the appropriate class.
> How do we know which class will be choosen by Geotools? Does this class
> depends only on the attribute or
> does it depends on the data source too?
> Are we guaranteed that the same class will always be used if we change
> the datasource or the version of geotools?
It depends on the data, the datasource and might depend on the gt2
version if we find out a binding was buggy in any way.
SimpleFeatureType provides you with the information of what class
is each attribute bound to, if you want to code generically you'll
have to use it.
If you decide you want a specific class no matter what, you can
also use converters, something like:
Double val = Converters.convert(feature.getAttribute("xxx"), Double.class);
Hope this helps
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users