1
鑑於我有POJO:Jackson2和龍目島@Builder
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class SomeResponse {
private String author;
private String authorTitle;
private String teaser;
private String text;
private Long lastModified;
private Long created;
private Integer rating;
private Optional<Markdown> markdown;
private Optional<Integer> wordCount;
}
當我嘗試使用這種正常傑克遜建設POJO:
restTemplate.getForObject(urlTemplate, SomeResponse.class,
productId.toString(), siteId.toString());
我得到一個例外,因爲有私人由於龍目島@Builder
註釋在SomeResponse
類的ctor。
如何在不刪除Lombok @Builder
註釋的情況下使其工作?