I have these beans:
public class Company {
private String name;
private List<Address> addresses;
...some other fields...
}
public class Address {
private String street;
private String city;
private boolean deleted;
...some other fields...
}
I also have some DTOs for those beans
public class CompanyDto {
private String name;
private List<AddressDto> addresses;
...some other fields...
}
public class AddressDto {
private String street;
private String city;
...some other fields...
}
(Please note that the AddressDto class lacks the deleted
field)
I'm using Mapstruct to map those beans to their DTOs. The mapper is this:
@Mapper
public interface CompanyMapper {
CompanyDto companyToCompanyDto(Company company);
List<AddressDto> ListAddressToListAddressDto(List<Address> addresses);
}
Now, in the mapping I want to ignore the Address instances whose deleted
field is true
. Is there a way for me to achieve that?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…