I created a couple of DTO's and a MapStruct interface for getting the User data:
public class UserDto {
private Long id;
private CountryDto country;
}
public class CountryDto {
private Long id;
private String name;
private List<TimeZoneDto> timeZones = new ArrayList<TimeZoneDto>();
}
@Mapper
public interface UserMapper {
UserMapper INSTANCE = Mappers.getMapper(UserMapper.class);
// TODO exclude country timezones
UserDto mapToDto(User entity);
}
I would like to modify UserMapper so the CountryDto timezones list are excluded
{
"id":1,
"country": {
"id": 182,
"name":"Australia"
}
}