The other option is to simply define the getter/setter method and lombok will not automatically produce the specified method.
I tested it myself and it seems to work fine:
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProductResponse {
private UUID id;
private String supplierId;
private String sku;
private String name;
private String brand;
private String imgUrl;
private String description;
private BigDecimal price;
private Float quantity;
private String unit;
//@Getter(AccessLevel.NONE) //This means @Data will not produce a getter for this field so have to explicitly define it
private Set<ProductTag> tags;
//Here we override @Data getter with a different getter (return is different type)
public List<UUID> getTags() {
return tags.stream().map(ProductTag::getId).collect(Collectors.toList());
}
}
You can always manually disable getter/setter generation for any field by using the special AccessLevel.NONE access level. This lets you override the behaviour of a @Getter, @Setter or @Data annotation on a class.