Accessing parent class when doing custom converter
I am currently using Dozer to map to sets of objects.
I have a situation where I need to use a custom converter to map a String to TypeA.
The way I convert TypeA to a String depends on the type of Object TypeA is a member of.
Specifically TypeA has 2 fields lets call them prefix and postfix. Sometimes I need to split the String by a space, or dash or slash. That chara开发者_JS百科cter to split on is defined in the parent of TypeA.
Is there a way to do this in Dozer with custom converters? I need to go up the chain...
Thanks in advance for any help.
So you should map a String to the parent of TypeA. In your xml file, to get to the "prefix" and "postfix" you would type, parent.TypeA.prefix
or parent.TypeA.postfix
. Hope this helps.
精彩评论