hi ron

IIRC there is a proto-project in the sandbox along these lines called convert. convertutils (in beanutils) is ok but is handicapped by backwards compatibility. it's been lacking momentum for some while but it's might be easier to revive that project that create a new one.

it's probably good that you don't have much code (just - hopefully - enthusiasm) since that avoids any thorny questions of importing external code. i'd suggest that you take a look at the convert project and about ways to take it forward. then next phase would be writing some patches and submitting them. (it might be wise to see whether they are any committers willing to act as mentors for convert before putting too much work in.)

here are some urls:

http://jakarta.apache.org/commons/volunteering.html
http://jakarta.apache.org/commons/patches.html
http://jakarta.apache.org/site/getinvolved.html

but there's quite a lot else on the web site and the wiki if you're willing to look hard enough.

- robert

On 19 Jan 2004, at 22: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:

Object a = new Integer(10);
Object b = "120";

assertEquals(new Integer(10),
             TypeConverter.convert(a, Integer.class));
assertEquals(new Integer(120),
             TypeConverter.convert(b, Integer.class));

Of course, it should be extensible, and maybe allow for transitive
conversions, eg

class Seconds extends Time {}
TypeConverter.registerConverter(Integer.class, Seconds.class, /* some
converter object here */);

assertEquals(new Seconds(25), TypeConverter.convert("25",
Seconds.class); /* done via String -> Integer -> Seconds conversion */

Or add some constraint checking:
System.out.println(new Integer(128).byteValue()); /* prints -128; is
that what you wanted? */

Currently, I have only my ideas to donate (ie, no code yet), and have
not previously contributed to jakarta, so any guidance is appreciated.

Thanks,
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]



Reply via email to