0

I have following class structure:

SOURCE

class c1 {
  List<c11> o1;
}
class c11 {
 List<c12> o2
}

TARGET

class c1 {
  List<c11> o1;
}
class c11 {
 c12 o2
}

Here is mapper class:

@Mapper
class MyMapper {
 c12 map(List<c12> o);
}

I get error: Can't generate mapping method from iterable to non-iterable type.

Now to solve this i am doing this:

default c12 map(List<c12> o) {
  return o.get(0);
}

even then i am getting this error can't map property List<c12> o1[].o2 to List<c12> o1[].o2. consider to declare/implement a mapping methos: c12 map(List<c12> value)

Manish Kumar
  • 10,214
  • 25
  • 77
  • 147
  • Your example looks to be incomplete. c12 is never defined – GJohannes Apr 18 '22 at 12:31
  • Does this answer your question? [mapstruct map iterable to non iterable](https://stackoverflow.com/questions/55341245/mapstruct-map-iterable-to-non-iterable) – GJohannes Apr 18 '22 at 12:46

0 Answers0