Andrea Aime wrote: > Justin Deoliveira ha scritto: >> Hi Emily, >> >> Emily Gouge wrote: >>> Thanks for the info Justin. (Sorry I'm slow getting back to you; I >>> was away last week). >>> >>> If I work at implementing this can I bug you for help and ask you to >>> review the work as I go along? I'm sure I'll need some advice on how >>> to do things properly. >> Yeah for sure. Basically the general idea is this. The first part is >> easy, just add a public hint to the Converters class (or maybe >> ConvterFactory): >> >> public static final Key SAFE_CONVERSION = new Key(Boolean.class); >> >> Then the next step is hunt down every implementation of the Converter >> interface, and have it respect the SAFE_CONVERSION hint if it is set. >> Off the top of my head this mostly applies to the NumericConverter, >> and the TemporalConverter. >> >> One hitch i notice is that while ConverterFactory.createConverter() >> takes a map of hints, Converter.convert() does not. So we probably >> have to add a method to the Converter interface. > > Agreed
Alternatively, the createConverter() function could make use of the hint and create either a "safe" or "non-safe" version of the converter. It looks to me like the way to convert values is to use the Converters.convert() method which can take hints. This method then uses those hints to create the correct converter. So I was thinking we let the createConverter() function use the hint and not add it to the convert() function. >>> Lastly - how do we define a "Safe Conversion"? Is this something we >>> can define or is this well defined somewhere. I'm thinking that >>> converting from integer to double is probably safe but not so for >>> double to integer. I'm sure the other types have similar properties. >> I guess any conversion that may result in any loss of information (a >> lossy conversion) would be considered unsafe? Perhaps someone has a >> more precise definition. > > Sounds good enough to me :) > Cheers > Andrea > Thanks All, Emily ------------------------------------------------------------------------------ _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel