On Wed, Jun 17, 2009 at 8:38 AM, Emily Gouge<ego...@refractions.net> wrote:
> Hmm I'm just not sure your extra code is needed.  There is already a
> converter to convert from Strings to Numbers - what I really need is to
> ensure that doubles are not converted to integers.

That sounds good.

> I wonder if we just need to call the convert function with Number instead of
> double/integer etc.  This will convert strings if necessary.  I'm thinking
> of this (passes all of the test cases you provided previously):
>
> Object o =  Converters.convert(v2, (v1 instanceof Number) ? Number.class
> : v1.getClass());
>
> instead of
>
> Object o =  Converters.convert(v2, v1.getClass());

Both those fail the test when:
- v1 is a number and v2 is a string
- both v1 or v2 are strings

I think you need a two pass check
1. Check if you can convert the values to Number; if so do a comparison
2. Continue with normal comparison as per before (try and make them
the same Compariable; and then compare)

------------------------------------------------------------------------------
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-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to