myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Ivankovits <ma...@ops.co.at>
Subject Re: inputCalender and other date libraries (joda)
Date Wed, 03 Aug 2005 16:29:00 GMT
Martin Marinschek wrote:
> we wouldn't want to introduce a dependency on joda, I would say.
No other dependency needed.
> If you find another way not disturbing the other users of this 
> component, go ahead and send in a patch as soon as you are finished!
But please give me a direction how complicated ;-) it should be:

>
>     I see two possible ways for now:
>     a) Having a global converter library which knows how to convert
>     from one
>     format to another
>     b) an additional component parameter e.g.
>     "valueConverter=' joda.dateConverter'".
>

a) will introduce a global registry which allows to register 
date-converters - inputCalender uses this registry and reflection to 
know how to convert during get/set the value.
No further change to the tag needet (no new parameter)
This registry might be useable for other components (validators?) too. 
And there is no need to restrict this registry to dates, virtually any 
from/to class converter might be registerable.
e.g. ConverterRegistry.addConverter(java.util.Date, joda.DateTime, 
DateDateTimeConverter)
e.g. ConverterRegistry.addConverter(Long, java.util.Date, LongDateConverter)

Every of the converter are able to converter bidirectionally.

The registry itself could be designed to be replace with 
http://jakarta.apache.org/commons/sandbox/convert/. (Again - no new 
dependency, the user is able to decide)


b) will simply use the converter passed in. This requires to add the 
converter to every tag, but is the easiest to implement.


I prefer Variant a as it might have the most power for the future, but I 
guess you might find it a to big blown framework just to solve the 
inputCalendar requirement now.
If you allow me to do it that way I'll do it. (No no dependency at 
first, I promise ;-) )

---
Mario

Mime
View raw message