ishara / orika

Automatically exported from code.google.com/p/orika
0 stars 0 forks source link

single lower case property name failed to map #171

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create two classes named "NotificationViewModel" and "Notification"
2. "NotificationViewModel" has a "nId" field, and "Notification" has a 
"notificationId" field.
3. then map the "notificationId" to "nId" by 
mapperFactory.classMap(NotificationViewModel.class, 
Notification.class).field("nId", "notificationId");

What is the expected output? What do you see instead?
I setup the mapping configuration in testng test class. and it failed.

The exception message:

FAILED CONFIGURATION: @BeforeMethod setUp
ma.glasnost.orika.MappingException: ClassMapBuilder.map(NotificationViewModel, 
NotificationStatus).field('iI', 'notificationId'): Error: iI does not belong to 
NotificationViewModel
    at ma.glasnost.orika.metadata.ClassMapBuilder.fieldMap(ClassMapBuilder.java:313)
    at ma.glasnost.orika.metadata.ClassMapBuilder.fieldMap(ClassMapBuilder.java:290)
    at ma.glasnost.orika.metadata.ClassMapBuilder.field(ClassMapBuilder.java:234)

What version of the product are you using? On what operating system?
v1.4.3, on Mac OS

Please provide any additional information below.
None.

Thanks,

Original issue reported on code.google.com by SteveSun...@gmail.com on 24 Jul 2014 at 2:09

GoogleCodeExporter commented 8 years ago
one mistake in the above description, the "Notification" should be 
"NotificationStatus".

Original comment by SteveSun...@gmail.com on 24 Jul 2014 at 2:10

GoogleCodeExporter commented 8 years ago
Can you please provide details how getter/setter are named

Original comment by elaat...@gmail.com on 24 Jul 2014 at 2:13

GoogleCodeExporter commented 8 years ago
I use lombok to auto generate setter/getters.

"setNId(String)" and "getNId()" for NotificationViewModel
"setNotificationId(String)" and "getNotificationId()" for NotificationStatus.

If I change "nId" to "NId" as register the mapping configration, it works.
mapperFactory.classMap(NotificationViewModel.class, 
Notification.class).field("NId", "notificationId").register();

BTW, I forgot add ".register()" in to the issue description, but I did write 
the register() method at the end in my code :-).

Original comment by SteveSun...@gmail.com on 24 Jul 2014 at 2:32

GoogleCodeExporter commented 8 years ago
I once encountered the same issue. The problem is that lombok generates gettes 
and setters incorrectly for single-lowercase-char-prefixed properties, if you 
don't want to rename properties, you can find solution in

https://code.google.com/p/orika/issues/detail?id=131

Original comment by Nikolajs...@gmail.com on 16 Sep 2014 at 6:14