Hi Robert,

Here is a use case for Date -> Calendar and Calendar -> Date.  Let's say I
have legacy DAOs that return java.util.Date.  I want to transfer this data
into a Transfer Object (TO) that was written recently.  This TO has the same
property names as the DAO, but uses the newer java.util.Calendar API.  When
the properties are transferred, most will just come over unchanged, but
Dates will need to be transformed into Calendars.

Also, after further investigation, I think you're right that [BeanUtils] is
not a good home for these Converters.  BeanUtils is pretty much limited to
Object -> String and String -> Object conversions because of the interface
of ConvertUtils.  This is because ConvertUtils is lacking a "Object
convert(Object, Class)" method.  Instead, it has "Object convert(String,
Class)".  I thought I had Object -> Object working (i.e. - Date -> Calendar
and Calendar -> Date) but I was mistaken.  Interestingly, the Convert
interface is flexible enough to support Object -> Object, so it's probably
good to be used unchanged in [convert].

Hopefully I will have time to contribute these converters to [convert] soon.
I will be sure to do good JavaDocs and test cases :)

Matt
----- Original Message ----- 
From: "robert burrell donkin" <[EMAIL PROTECTED]>
To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]>
Sent: Monday, March 15, 2004 5:48 PM
Subject: Re: [BeanUtils] [convert] Date -> Calendar and Calendar -> Date
converters


> hi Matthew
>
> sounds a little intriguing. i suspect that convert may be a better home
> since i'm not really sure i understand the typical use case for this in
> beanutils (but i'd be very happy if you'd enlighten me).
>
> what's especially import are good javadocs and good unit tests (since
> these often take as long to write for the code). contributing these
> will dramatically increase the chances of adoption.
>
> - robert
>
> On 12 Mar 2004, at 18:16, Matthew Sgarlata wrote:
>
> > Would [BeanUtils] be interested in converters that can handle
> > java.util.Date -> java.util.Calendar and java.util.Calendar ->
> > java.util.Date?  If not, how about [convert]?
> >
> > Thanks,
> >
> > Matt
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to