I have a scenario where i need to use the payload as
{"authType":"PDS"}
or
{"authType":"xyz","authType2":"abc",}
or
{"authType":"xyz","authType2":"abc","authType3":"123"}
or
any combination except for null values.
tham chiếu đến mã tôi có 3 trường nhưng không sử dụng trường giá trị rỗng. Về cơ bản tôi không muốn bao gồm trường có giá trị null.Jackson: Có điều kiện chọn các trường
Có bất kỳ chú thích được sử dụng để làm cho nó thực hiện
public class AuthJSONRequest {
private String authType;
private String authType2;
private String authType3;
public String getAuthType() {
return authType;
}
public void setAuthType(String authType) {
this.authType = authType;
}
public String getAuthType2() {
return authType2;
}
public void setAuthType2(String authType2) {
this.authType2 = authType2;
}
public String getAuthType3() {
return authType3;
}
public void setAuthType3(String authType3) {
this.authType3 = authType3;
}
}