Map multiple attributes in deep hierarchy to a single object.

975 views
Skip to first unread message

Daniel Kelleher

unread,
Nov 3, 2017, 6:20:04 AM11/3/17
to modelmapper
Hello, I have a data structure that looks like this:

A
  -B
    -C1
    -C2

where one of C1 and C2 is not null

and I would like to map it to a structure:

A'
  -B'
    -C'

Destination class C' has all properties in both C1 and C2. Note - C1 and C2 don't share a superclass or interface.

Depending on what I try I get different errors here. Including 
"The destination property map.destination.A.setB()/map.destination.B.setC()/map.destination.C.setName() matches multiple source property hierarchies:"

What is the best way to go about this?

I have attached a minimal example as a source jar (incl. Junits) if it helps, just remove the _file extension suffix as Google Groups complained when I tried to upload it as a .jar . I'm pretty new to ModelMapper so apologies if I've missed something obvious!

Thanks,

Daniel Kelleher
test.jar_file
Reply all
Reply to author
Forward
0 new messages