You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Matthew Sgarlata <sg...@crystalcognition.com> on 2004/03/12 19:16:27 UTC
[BeanUtils] [convert] Date -> Calendar and Calendar -> Date converters
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [BeanUtils] [convert] Date -> Calendar and Calendar -> Date converters
Posted by Matthew Sgarlata <sg...@crystalcognition.com>.
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" <ro...@blueyonder.co.uk>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
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: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [BeanUtils] [convert] Date -> Calendar and Calendar -> Date converters
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
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: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org
Re: [BeanUtils] [convert] Date -> Calendar and Calendar -> Date converters
Posted by Stephen Colebourne <sc...@btopenworld.com>.
[convert] can adopt lots of different converters once the design is agreed.
These sound like good inclusions.
Stephen
----- Original Message -----
From: "Matthew Sgarlata" <sg...@crystalcognition.com>
> 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org