commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject Re: [convert]conversion with default values
Date Sat, 20 Mar 2004 01:13:21 GMT
> >The ObjectToInt conversion isn't quite what I had in mind, although
> >interestingly the [convert] system does allow it. I want a system where
> >there is one converter for Number subclasses to Integer and one for
> >to Integer. The trick is then to design a combination engine to allow
> >StringBuffer to Integer by combining StringBuffer to String plus String
> >Integer.

> Sounds interesting. Do you have already concrete ideas how such a
> combination engine would look like? I have thought about converters
> working together in a kind of chain, too, e.g. for String to Integer
> conversion: first try a simple Integer.parseInt() and if this fails, try
> a Locale aware parsing that deals with formatted values. Or conversion
> of arrays or collections of one type into arrays/collections of another
> type: here the converter dealing with the iteration stuff should be
> independent of the converter handling the single elements.
> These are all slightly different use cases that should be supported by
> such an engine. What do you think?

Ron Blasch had some ideas on how this might work. I've cced to see if he
wants to comment. At present my only thought was to work based on the
percent value
Double to Number, value=80
Number to Integer, value=80
Double to String, value=20
String to Integer, value=80
A average of the two combinations gives the best route to take.

But I'm sure there's a better way ;-)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message