Over-Fetching
DATA
[name: 'kim', age: 27]
DTO
public class OOODTO {
private String name;
private Integer age;
private String address;
private String option;
}
JSON
{
name: 'kim',
age: 27,
address: null,
option: null
}
Under-Fetching
DATA
[name: 'kim', age: 27, address: '서울 방배', option: 'A']
public class OOODTO {
private String name;
private Integer age;
}
{
name: 'kim',
age: 27
}
Inner Class
를 적절히 활용하기!public class Info {
@Builder
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
public static class CardInfo implements Serializable {
private static final long serialVersionUID = -XXXL;
private String cardName;
private Integer cardCode;
}
@Builder
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
public static class LastestPay implements Serializable {
private static final long serialVersionUID = -XXXL;
private Boolean isRecentCard;
private MyLatestPayInfo myLatestPayInfo;
}
@Builder
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
public static class Response implements Serializable {
private static final long serialVersionUID = XXXL;
private CardInfo cardInfo;
private LastestPay lastestPay;
}
@Builder
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
public static class Request implements Serializable {
private static final long serialVersionUID = XXXL;
private Parameter param;
}
}