You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Create three classes as described in User Guide:
public class Name {
private String first;
private String last;
private String fullName;
//getters & setters
}
public static class Person {
private List<Name> names;
//getters & setters
}
public static class PersonDto {
private Map<String, Name> personalNames;
//getters & setters
}
2. Create mapping and facade as described in user guide:
mapperFactory.classMap(Person.class, PersonDto.class)
.field("names{fullName}", "personalNames{key}")
.field("names{}", "personalNames{value}")
.register();
MapperFacade mapper = mapperFactory.getMapperFacade();
3. Attempt to map Person to PersonDto (as per User Guide)
PersonDto personDto = mapper.map(person, PersonDto.class);
What is the expected output? What do you see instead?
Each Name in List<Name> should be mapped to Map<Name.fullName, Name>
Instead a ClassCastException occurs:
"java.lang.ClassCastException: java.lang.Object cannot be cast to <package>.Name"
What version of the product are you using? On what operating system?
Tested on both Orika 1.4.2 (as per User Guide) and Orika 1.4.5 (latest)
Windows-7, 64bit
Please provide any additional information below.
Testcase attached
Duplicate of issue 166 - which has not been Accepted
Original issue reported on code.google.com by [email protected] on 30 Mar 2015 at 4:20
Code works if an explicit mapper is added for Name (see attached code)
mapperFactory.classMap(Name.class, Name.class)
.byDefault()
.register();
I would have thought this would not be necessary, and don't understand why it
is.
Before closing this issue, can someone please explain either here - or
preferably in the User Guide
Thanks
Original issue reported on code.google.com by
[email protected]
on 30 Mar 2015 at 4:20Attachments:
The text was updated successfully, but these errors were encountered: