Hi all, in GeoServer land we have a little problem that could be solved by a casting/converting function, and trying to check if this is ok with other people as well.
Basically we have user layers expressed in SLD, where a GML feature collection, completely typeless in terms of attributes (since there is no schema reference), is being rendered using filters that have to do numeric comparisons. However, the feature attribute themselves are assumed to be strings, given there is no type information for them, and the sld literals are parsed as strings as well. Filter wise, this ends up being a string to string comparison, which has a different meaning than the desired numeric one. (if you want more details, here is the issue: http://jira.codehaus.org/browse/GEOS-2053) Now, the compare filter code could try an implicit promotion in theory, and see if both sides can be turned into numbers. But that would be a good idea, we have already been beaten a number of times by things that look numbers but are in fact strings, like codes with leading zeroes. Generally speaking trusting the feature type values to be in the right type already is a good idea. So, for case I cited at the beginning, I believe exposing the converters as a filter function could be a good idea: <Function name="convert"> <Literal>15.0</Literal> <Literal>java.lang.Double</Literal> </Function> where the second literal identifies the target class. The easiest way would be just just do the above, and do a Class.forName for the target class. With a little extra effort we can support primitives as well, and assume that classes without name are sitting in java.lang. This name -> Class conversion seems to demand, guess what... a converter ;-) Opinions? Cheers Andrea ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
