-1

The example here: https://github.com/mapstruct/mapstruct-examples/blob/3457f37c24ea7799b0752cc7ee8307283ab09ad2/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/EmployeeMapper.java

The generated mapping will be like:

Employee toEmployee(EmployeeDto employeeDto, CycleAvoidingMappingContext context) {...}

In practice, how to get a valid CycleAvoidingMappingContext object ?

cviniciusm
  • 139
  • 1
  • 2
  • 13

1 Answers1

1

You use the constructor.

new CycleAvoidingMappingContext()

When in doubt, look for unit tests.

https://github.com/mapstruct/mapstruct-examples/blob/master/mapstruct-mapping-with-cycles/src/test/java/org/mapstruct/example/EmployeeMapperTest.java#L59

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245