gpt4 book ai didi

java - 存在时抛出 Jackson UnrecognizedPropertyException

转载 作者:行者123 更新时间:2023-11-29 08:29:00 24 4
gpt4 key购买 nike

我有一个使用 bott 2.0.0.0 的基本 spring boot 独立可执行 jar 我认为这很简单,但谷歌不会放弃答案。 :) 我正在使用最新的稳定 jackson 版本 (2.9.4),但它们由 spring 管理。这是一个 boolean 问题:

这是我试图转换成 Java Pojo 的 JSON(它被包裹在一个更高的对象中,但我不认为这是问题所在。我在 boolean 值方面遇到了问题。

{
"guid": "a5182918-8d69-11e6-acb6-0a97227b08ed",
"organizationId": 1,
"region": "Tariff Picker",
"stages": [{
"nextStages": [],
"activities": [{
"nextActivities": [],
"name": "New Activity",
"suspensionReason": "",
"rules": [],
"isSuspend": false,
"sequence": 1,
"allowedRoles": [{
"userApplications": [],
"name": "submitApplication",
"organizationId": 0,
"workQueues": [],
"roleApplicationsForSystemRoleId": [],
"isPublic": 0,
"widgetRoles": [],
"userRoles": [],
"roleTariffReports": [],
"roleTypeId": 0,
"distributionListRoles": [],
"organizationRoles": [],
"publicationRoles": [],
"roleTariffDataSets": [],
"roleApplicationsForApplicationRoleId": [],
"workQueueArchives": [],
"id": 11,
"rolePrivileges": []
}],
"label": "New Activity",
"irrevocable": false,
"stageId": 0,
"id": 0,
"buttonPrompt": "Submit",
"guid": "2e195e0c-83d2-491f-b2e8-3ad1159d1d99",
"dataBlock": {
"sections": [{
"info": "",
"prompt": "",
"name": "First Section",
"sequence": 0,
"fields": [],
"gatingConditions": [],
"guid": "480d160c-c34f-4022-97b0-e8a1f28c49ae",
"id": -2
}],
"prompt": "",
"id": -1,
"name": ""
},
"autoExecute": false
}],
"name": "Tariff Selection Stage",
"sequence": 1,
"rules": [],
"completionMessage": "",
"guid": "65a73280-c587-486f-be8b-9107426f4730",
"id": 0,
"description": ""
}],
"stop": "3000-01-01",
"workflowTypeId": 2,
"isUserAction": false,
"start": "1900-01-01",
"isSandbox": false,
"gatingConditions": [],
"tariffId": 49,
"businessCalendarId": 1,
"applicationForms": [],
"id": 49,
"rules": []
}

我收到一条错误消息,指出没有名为“isSuspend”的字段,如您所见,它就在那里(第 3 行),甚至设置为 false。这是我的 pojo:

    private int id;
private String name;
private List<DataBlockObject> dataBlocks;
private int sequence;
private List<RuleObject> rules;
private List<AllowedRoleObject> allowedRoles;
private List<NextActivityObject> nextActivities;
private List<ActivityPermissionObject> activityPermissions;
private boolean autoExecute;
private boolean irrevocable;
private String label;
private String buttonPrompt;
private int stageId;
private boolean isSuspend;
private String suspensionReason;
private String guid;
private List<ActivitySubmitErrorPromptObject> activitySubmitErrorPrompts;
private int activitySubmitErrorTimeout;
private String breadcrumbClass;

public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<DataBlockObject> getDataBlocks() {
return dataBlocks;
}
public void setDataBlocks(List<DataBlockObject> dataBlocks) {
this.dataBlocks = dataBlocks;
}
public int getSequence() {
return sequence;
}
public void setSequence(int sequence) {
this.sequence = sequence;
}
public List<RuleObject> getRules() {
return rules;
}
public void setRules(List<RuleObject> rules) {
this.rules = rules;
}
public List<AllowedRoleObject> getAllowedRoles() {
return allowedRoles;
}
public void setAllowedRoles(List<AllowedRoleObject> allowedRoles) {
this.allowedRoles = allowedRoles;
}
public List<NextActivityObject> getNextActivities() {
return nextActivities;
}
public void setNextActivities(List<NextActivityObject> nextActivities) {
this.nextActivities = nextActivities;
}
public List<ActivityPermissionObject> getActivityPermissions() {
return activityPermissions;
}
public void setActivityPermissions(List<ActivityPermissionObject> activityPermissions) {
this.activityPermissions = activityPermissions;
}
public boolean isAutoExecute() {
return autoExecute;
}
public void setAutoExecute(boolean autoExecute) {
this.autoExecute = autoExecute;
}
public boolean isIrrevocable() {
return irrevocable;
}
public void setIrrevocable(boolean irrevocable) {
this.irrevocable = irrevocable;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getButtonPrompt() {
return buttonPrompt;
}
public void setButtonPrompt(String buttonPrompt) {
this.buttonPrompt = buttonPrompt;
}
public int getStageId() {
return stageId;
}
public void setStageId(int stageId) {
this.stageId = stageId;
}
public boolean isSuspend() {
return isSuspend;
}
public void setSuspend(boolean isSuspend) {
this.isSuspend = isSuspend;
}
public String getSuspensionReason() {
return suspensionReason;
}
public void setSuspensionReason(String suspensionReason) {
this.suspensionReason = suspensionReason;
}
public String getGuid() {
return guid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public List<ActivitySubmitErrorPromptObject> getActivitySubmitErrorPrompts() {
return activitySubmitErrorPrompts;
}
public void setActivitySubmitErrorPrompts(List<ActivitySubmitErrorPromptObject> activitySubmitErrorPrompts) {
this.activitySubmitErrorPrompts = activitySubmitErrorPrompts;
}
public int getActivitySubmitErrorTimeout() {
return activitySubmitErrorTimeout;
}
public void setActivitySubmitErrorTimeout(int activitySubmitErrorTimeout) {
this.activitySubmitErrorTimeout = activitySubmitErrorTimeout;
}
public String getBreadcrumbClass() {
return breadcrumbClass;
}
public void setBreadcrumbClass(String breadcrumbClass) {
this.breadcrumbClass = breadcrumbClass;
}

最佳答案

问题可能是因为字段 isSuspend 的 getter 和 setter 名称吗?尝试命名 getter 和 setter getIsSuspend 和 setIsSuspend

关于java - 存在时抛出 Jackson UnrecognizedPropertyException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49833835/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com