Mapping a source to multiple targets based on a conditional field value

810 views
Skip to first unread message

AJ

unread,
Jul 27, 2013, 5:18:01 PM7/27/13
to dozer-...@googlegroups.com
Does anyone know how one can conditionally map one source to multiple targets based on some text value found in the source property. 
For example,
if source.field == "a"
<mapping>
 <class-a>Source</class-a>
 <class-b>TargetA</class-b>
...[field-mappings]...
</mapping>

if source.field == "b"
<mapping> <class-a>Source</class-a> <class-b>TargetB</class-b> ...[field-mappings]... </mapping>


if source.field == "c"
<mapping>
 <class-a>Source</class-a>
 <class-b>TargetC</class-b>
...[field-mappings]...
</mapping>


I did look at context mappings, custom converters, and inheritance mappings and event listeners.  Neither of seems to do it for me in the sense i am not sure where to put the logic and where to specify mappings.   Any ideas?

E.g.
http://javadevspot.wordpress.com/2012/02/28/hello-world/
http://dozer.sourceforge.net/documentation/contextmapping.html
http://dozer.sourceforge.net/documentation/customconverter.html
http://dozer.sourceforge.net/documentation/baseattributes.html
http://dozer.sourceforge.net/documentation/events.html
Thanks,
AJ


Reply all
Reply to author
Forward
Message has been deleted
0 new messages