Effect @JsonAutoDetect (fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE) the annotation is: attribute name used to turn json. To prevent faulty properties being given, such as app_id
@JsonIgnoreProperties (ignoreUnknown = true)
action of the annotation is: the object is performed json turn prevents incoming json string contains the absence of properties cause error.
案例:
1 @JsonAutoDetect(fieldVisibility = Visibility.ANY, getterVisibility = Visibility.NONE, isGetterVisibility = Visibility.NONE)
2 @JsonIgnoreProperties(ignoreUnknown = true)
3 public class UnifiedPayOrderResponse {
4
5 private String code;
6
7 private String message;
8
9 private String main_order_code;
10
11 private String app_id;
12
13 public String getCode() {
14 return code;
15 }
16
17 public void setCode(String code) {
18 this.code = code;
19 }
20
21 public String getMessage() {
22 return message;
23 }
24
25 public void setMessage(String message) {
26 this.message = message;
27 }
28
29 public String getMain_order_code() {
30 return main_order_code;
31 }
32
33 public void setMain_order_code(String main_order_code) {
34 this.main_order_code = main_order_code;
35 }
36
37 public String getApp_id() {
38 return app_id;
39 }
40
41 public void setApp_id(String app_id) {
42 this.app_id = app_id;
43 }
44
45 }