我的json可以是以下两种类型
{
"corresponding_address_same_as_permanent_address": "yes",
"corresponding_address" : "123,abc",
"corresponding_pincode" : "484333"
}
或
{
"corresponding_address_same_as_permanent_address": "no",
"corresponding_address" : "123,abc",
"corresponding_pincode" : "484333",
"permanent_address" : "123,perm",
"permanent_pincode" : "484332"
}
我有一个Java类:
class Address {
String corresponding_address_same_as_permanent_address;
String corresponding_address;
String corresponding_pincode;
String permanent_address;
String permanent_pincode;
}
取决于字段corresponding_address_same_as_permanent_address
我需要在代码中设置字段permanent_address
和permanent_pincode
。在这种情况下,哪些注释会有所帮助?