I have the following mapstruct interface:
@Mapper
public interface CustomerMapper
{
CustomerMapper INSTANCE = Mappers.getMapper(CustomerMapper.class);
public Customer fromEntity(CustomerEntity customerEntity);
@InheritInverseConfiguration
CustomerEntity fromCustomer (Customer customer);
}
and here is the generated class:
public class CustomerMapperImpl implements CustomerMapper {
public CustomerMapperImpl() {
}
public Customer fromEntity(CustomerEntity customerEntity) {
if (customerEntity == null) {
return null;
} else {
Customer customer = new Customer();
return customer;
}
}
public CustomerEntity fromCustomer(Customer customer) {
if (customer == null) {
return null;
} else {
CustomerEntity customerEntity = new CustomerEntity();
return customerEntity;
}
}
}
Where are the setters ? The generated class is supposed to call the setters and to initialize properties, for example:
...
Customer customer = new Customer();
customer.setXXX(customerEntity.getXXX());
...
Here is the maven compile plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>11</source>
<target>11</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombock.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
Did I miss anything here ?
Many thanks in advance.
Seymour