I'm currently new to dozer. I'm able to map my excel file to java object flawlessly using map K,V. the problem is when Im mapping '$5000' from excel to java double/BigDecimal, ofcourse there's a conversion exception. I can use custom converter to correct the data but what id really like to do is get the "KEY" or the "VALUE" in which the error occurs and display it on the page. Is it possible with dozer? I researched about dozer event but it doesn't have enough resources or sample codes for me to check in to. thanks
Asked
Active
Viewed 868 times
1 Answers
0
You couldn't get the "KEY" and the "VALUE" using a listener either because the only listener method that is executed before a ConversionException
is thrown, is public void mappingStarted(DozerEvent arg0)
and its event parameter (DozerEvent
) will provide you with the instance of the source object but Not the element of the Map
being mapped.
I think not even with custom converters is possible to get the details of the Map element being mapped. Your best option would be to create a custom converter from Map
to Object
and use the custom-converter-param
to pass the key of the property you want to map. In the converter you would have to take care of the values validation and mapping.

davidmontoyago
- 1,834
- 14
- 18