Closed GoogleCodeExporter closed 9 years ago
(changed to an Enhancement request)
The default conversion from Date to Calendar and back again is not built-in;
but as shown from the attached test case, it can easily be implemented by
registering a BidirectionalConverter<Date, Calendar> on the mapper factory.
This does bring up a good point though -- there are some (maybe many) default
conversions that you might just expect to take place (like this example); we
can look at the possibility of adding default converters for these cases,
depending on how it affects performance and also the ability to override...
Original comment by matt.deb...@gmail.com
on 9 May 2012 at 2:21
Attachments:
[deleted comment]
As a part of the 1.2.0 branch, you can now automatically register an additional
set of builtin converters (which includes the ability to handle this case), by
applying a setting to the DefaultMapperFactory.Builder.
Like so:
MapperFactory factory = new DefaultMapperFactory.Builder()
.usedBuiltinConverters(true)
.build();
It can also be done by explicitly registering the builtin
DateAndTimeConverters.DateToCalendarConverter which can handle this type, like
so:
MapperFactory factory = new DefaultMapperFactory.Builder().build();
factory.getConverterFactory().registerConverter(new DateAndTimeConverters.DateToCalendarConverter());
Original comment by matt.deb...@gmail.com
on 9 Jul 2012 at 5:36
Original issue reported on code.google.com by
raok...@gmail.com
on 8 May 2012 at 3:33