The multi-directional thing did not happen. The new structure is quite elegant and very flexible though. Depending on what you want to achieve, it is now either easier or harder to work with, you if you're having troubles with it, please don't hessitate to ask for help.
Here's Jonathans mail:
i just finished a checkin of new conversion code. API is quite a bit different, so please examine it carefully.
i spent all day today working on this, so please ask questions before tweaking anything. i'm pretty sure i got this right.
major changes:
- folded localization into a single converter hierarchy
- implemented converters for all primitive types plus Date and String
- introduced ITypeConverter interface for conversions TO some implicit type. this is mainly of
interest internally, since the IConverter interface is more general and useful. but use of type
converters directly is supported and some mucking with ITypeConverters may be necessary
to configure format/parse patterns for locales for your application.
- refactored and simplified Component and TypeValidator to use the new conversion code
this should all be automatic goodness!
pseudo code example of converter API (again, if you're using TypeValidator, you may not even
need to know this):
IConverterFactory f = new ConverterFactory(); IConverter c = f.newConverter();
String s = c.convert(new Integer(5), String.class);
Integer i = c.convert("5", Integer.class);c.setLocale(Locale.DUTCH);
String s = (String)c.convert(new Date(), String.class);
Date d = (Date)c.convert("10-okt-2002", Date.class);individual conversions can be registered on the Converter class by the factory,
which is something most people won't generally need to do since
by default conversions are made available for all Java language primitive types
and their enclosing first class objects. also conversions to and from Date and
String are supported. all these conversions will respect Locale if you set it
on the converter and each converter's format can be set if you don't like the
default format for the locale.
conversions to String are somewhat more complex internally and involve registering
string formatting converters (which still implement the same ITypeConverter
interface) on the StringConverter object. this is really quite elegant and allows
for any arbitrary formatting when converting objects to strings. currently locale
formatting for Date and Number types is supported.
Jonathan Carlson wrote:
A while ago Eelco discussed changing the converter interface to be multi-directional.
Is this still in the queue of things to do or did I misinterpret what was going to happen?
I'm getting ready for these changes, but I don't want to push you developers if you are still busy with other things.
Thanks!
- Jon
********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager.
www.katun.com **********************************************************************
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
