小编Rah*_*ddy的帖子

杰克逊:条件选择领域

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.
Run Code Online (Sandbox Code Playgroud)

参考代码我有3个字段但只使用空值字段.基本上我不想包含具有空值的字段.

是否有任何注释用于完成它

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 …
Run Code Online (Sandbox Code Playgroud)

jackson

7
推荐指数
2
解决办法
7007
查看次数

标签 统计

jackson ×1