Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar as destination throwing exception #14

Closed
GoogleCodeExporter opened this issue Apr 14, 2015 · 3 comments
Closed

Calendar as destination throwing exception #14

GoogleCodeExporter opened this issue Apr 14, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. if the destination object is Calendar(java.util.Calendar)
example:

Source:
class Product {

 private Date tempCal;

}

Destination:

class ProductDTO {

 private Calendar tempCal;

}


What is the expected output? What do you see instead?
 It should map without any error, Instead it throws an exception

"No concrete class mapping defined for source class"

What version of the product are you using? On what operating system?
1.1.1 windows 7

Please provide any additional information below.

1) It should not throw any exception for Calendar, XMLGregorianCalendar 


Original issue reported on code.google.com by raok...@gmail.com on 8 May 2012 at 3:33

@GoogleCodeExporter
Copy link
Author

(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

  • Changed state: Accepted
  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

Attachments:

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant