Check out [convert] for these complaints Ron. The lookup structure is changed so that the From and the To are specified [though it defaults to a From of String to help the beanutils guys].
I thought I made a stab at the smart completion, ie) If asked for A->C and only have A-B and B-C, then it does it, but I may have just commented it as a TODO. Will attempt to check when I get a night free from work. Hen On Tue, 20 Jan 2004, Ron Blaschke wrote: > Monday, January 19, 2004, 11:34:36 PM, you wrote: > SK> On Tue, 2004-01-20 at 11:07, Ron Blaschke wrote: > >> I am posting this here because I think commons would be the > >> right place to put such a library. Please tell me if it's not. > >> > >> The idea is to allow conversion for (almost?) any object into another. > >> I'd like to see code such as this working: > > SK> Have you looked at ConvertUtils in the BeanUtils library yet? > > SK> http://jakarta.apache.org/commons/beanutils/api/index.html > > SK> It does pretty much what you describe here. You may wish to look at > SK> that, then send a mail describing how your ideas differ from what is > SK> already there.. > > In ConvertUtils, the conversion relies a lot on JDK implementations, > which is quite "relaxed." Eg, Integer(128) -| Byte(-128), > Double(1.3d) -| Integer(1), etc. I'd like to see a more configurable > approach, for example: > strict: "1.23" -| Integer ... not possible, raise Exception > relaxed: "1.23" -| Integer(1) ... seems ok > > or: > strict: Integer(128) -| Byte ... no way! raise Exception > relaxed: Integer(128) -| Byte(127) ... close enough > > The converter should enable transitive conversions, that is if one > converter knows about A to B conversion, and another from B to C, both > together should know about A to C. In the Seconds example, it would > suffice for the user supplied Seconds converter to know about > Integers to allow conversion from String via Integer to Second. > In ConvertUtil, the converter must know about all possible conversions > (well, most of it is handed off to Java, which is ok, but I'd rather > not go down that lane.) > > That's all that is on top of my head. For more, I'd have to dig a day > or so. :-) > > Ron > -- > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]