杰克逊将如何从具有oneOf的json模式生成pojo

时间:2016-10-14 04:54:11

标签: json jackson2

{
    "type" : "object",
    "properties" : {
        "street_address" : {
            "type" : "string"
        },
        "city" : {
            "type" : "string"
        },
        "state" : {
            "type" : "string"
        }
    },
    "oneOf" : [{
            "required" : ["city"]
        }, {
            "required" : ["state"]
        }
    ],
    "required" : [
        "street_address"
    ],
    "additionalProperties" : false
}

这个json架构的Java类是什么? 当我生成类时,类

中没有像街道地址这样的属性

1 个答案:

答案 0 :(得分:-1)

class One{
String streetAddress;
String city;
String state;

// put getters and setters for each of the member variables.

}

我希望,您的查询将解决:)