mapstruct / mapstruct-spring-extensions

Helpful additions to MapStruct when using the Spring Framework.
Apache License 2.0
147 stars 32 forks source link

how can i use "Inverse mappings" #71

Closed kevinmails closed 1 year ago

kevinmails commented 1 year ago

My code like this: public interface CarMapper extends Converter<Car, CarDTO> { @Override @Mappings( @Mapping(source = "wheels",target = "carWheels") ) CarDTO convert(Car source); }

how can i get a Inversed method "Car convert(CarDTO source);"

Chessray commented 1 year ago

There's no built-in way to achieve this. Spring Converters work in only one direction. If you require a two-way mapping, you'll have to define a second Converter skeleton.