-1

I have to map an object to list of another objects like below

public List map(ClassA A){

 List<ClassB> list = new ArrayList<ClassB>();
 ClassB C1 = new ClassB();
  ClassB C2= new ClassB();

.... Logic to populate C1 and C2 from ClassA add C1 and C2 to list

return list;

}

In the generated Impl class, I am getting a complilation error "Cannot find the symbol ClassB". The class "ClassB" is not imported to the generated impl class. Please help me in solving this.

Anil Bhaskaran
  • 495
  • 1
  • 8
  • 23

1 Answers1

0

MapStruct cannot generate mapping methods between iterable types (List<ClassB>) and non-iterable types (ClassA).

Can you share the definitions of ClassA and ClassB in more detail? Then we can try and find a good solution. Probably it's simplest though to just implement this one from hand (esp. if ClassA contains a list of ClassB, in which case no mapping for the list elements is required).

Gunnar
  • 18,095
  • 1
  • 53
  • 73