场景可以穷举嘛,实际上也没有几个不同的场景。类似这样 大概来个例子: [code=java] public class User { @JsonPropertyGroup({"FULL_USER","SIMPLE_USER"}) Integer id; @JsonPropertyGroup({"FULL_USER","SIMPLE_USER"}) String name; @JsonPropertyGroup({"FULL_USER"}) Boolean gender; @JsonPropertyGroup({"FULL_USER"}) @JsonUsingGroup("SIMPLE_USER") Organiztion org; } public class Order { @JsonPropertyGroup("FULL") @JsonUsingGroup("SIMPLE_USER") User user; @JsonPropertyGroup("FULL") Map<@JsonUsingGroup("SIMPLE_PRODUCT")Product,Integer> product; }/code]User定义了2种序列化方案:SIMPLE_USER,FULL_USER Order中鼎了一种序列化方案:FULL, 其中的复杂属性user采用SIMPLE_USER方案。 不知道有没有大神已经实现了类似的机制,或者有同学像个这方面的问题,请分享一下
public class User { @JsonPropertyGroup({"FULL_USER","SIMPLE_USER"}) Integer id; @JsonPropertyGroup({"FULL_USER","SIMPLE_USER"}) String name; @JsonPropertyGroup({"FULL_USER"}) Boolean gender; @JsonPropertyGroup({"FULL_USER"}) @JsonUsingGroup("SIMPLE_USER") Organiztion org; } public class Order { @JsonPropertyGroup("FULL") @JsonUsingGroup("SIMPLE_USER") User user; @JsonPropertyGroup("FULL") Map<@JsonUsingGroup("SIMPLE_PRODUCT")Product,Integer> product; } 汗,编辑自己的帖子居然没有权限
场景可以穷举嘛,实际上也没有几个不同的场景。类似这样
大概来个例子:
[code=java]
public class User {
@JsonPropertyGroup({"FULL_USER","SIMPLE_USER"})
Integer id;
@JsonPropertyGroup({"FULL_USER","SIMPLE_USER"})
String name;
@JsonPropertyGroup({"FULL_USER"})
Boolean gender;
@JsonPropertyGroup({"FULL_USER"})
@JsonUsingGroup("SIMPLE_USER")
Organiztion org;
}
public class Order {
@JsonPropertyGroup("FULL")
@JsonUsingGroup("SIMPLE_USER")
User user;
@JsonPropertyGroup("FULL")
Map<@JsonUsingGroup("SIMPLE_PRODUCT")Product,Integer> product;
}/code]User定义了2种序列化方案:SIMPLE_USER,FULL_USER
Order中鼎了一种序列化方案:FULL, 其中的复杂属性user采用SIMPLE_USER方案。
不知道有没有大神已经实现了类似的机制,或者有同学像个这方面的问题,请分享一下
@JsonPropertyGroup({"FULL_USER","SIMPLE_USER"})
Integer id;
@JsonPropertyGroup({"FULL_USER","SIMPLE_USER"})
String name;
@JsonPropertyGroup({"FULL_USER"})
Boolean gender;
@JsonPropertyGroup({"FULL_USER"})
@JsonUsingGroup("SIMPLE_USER")
Organiztion org;
}
public class Order {
@JsonPropertyGroup("FULL")
@JsonUsingGroup("SIMPLE_USER")
User user;
@JsonPropertyGroup("FULL")
Map<@JsonUsingGroup("SIMPLE_PRODUCT")Product,Integer> product;
}
汗,编辑自己的帖子居然没有权限