I try to use mapstruct feature @InheritInverseConfiguration. But it gives me the following error: There is no suitable result type constructor for reversing this method. But the generated Impl look pretty good.
@Mapper(uses = {
BOIdMapper.class,
DateMapper.class,
CarVOFactory.class,
})
public interface CarMapper {
CarMapper INSTANCE = Mappers.getMapper(CarMapper .class);
@Mappings({
@Mapping(source = "VOKey", target = "id"),
@Mapping(source = "gueltAb", target = "gueltigAb")
})
Car map(CarVO carVO);
@InheritInverseConfiguration
CarVO map(Car car);
public class CarVOFactory {
public CarVO createCarVO() {
return VOFactory.createVO(CarVO.class);
}
}
}
This is the POJO Car
public class Car {
private String id;
private LocalDate gueltigAb;
...
}
This is the other Car-Class:
public interface CarVO extends ... {
void setVOKey (VOKey<CAR> voKey);
}
And this is the generated Impl:
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2017-08-29T08:55:10+0200",
comments = "version: 1.1.0.Final, compiler: Eclipse JDT (IDE) 1.2.100.v20160418-1457, environment: Java 1.8.0_102 (Oracle Corporation)"
)
public class CarMapperImpl implements CarMapper {
private final BOIdMapper bOIdMapper = new BOIdMapper();
private final DateMapper dateMapper = new DateMapper();
private final CarVOFactory CarVOFactory = new CarVOFactory();
@Override
public Car map(CarVO CarVO) {
if ( CarVO == null ) {
return null;
}
Car Car = new Car();
Car.setGueltigAb( dateMapper.asLocalDate( CarVO.getGueltAb() ) );
Car.setId( bOIdMapper.asId( CarVO.getVOKey() ) );
return Car;
}
@Override
public CarVO map(Car Car) {
if ( Car == null ) {
return null;
}
CarVO CarVO = CarVOFactory.createCarVO();
return CarVO;
}
Linked
I try to use mapstruct feature @InheritInverseConfiguration. But it gives me the following error: There is no suitable result type constructor for reversing this method. But the generated Impl look pretty good.
This is the POJO Car
This is the other Car-Class:
And this is the generated Impl:
Linked