加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – Google Cloud Endpoints未在API资源管理器中显示Map

发布时间:2020-12-15 02:08:52 所属栏目:Java 来源:网络整理
导读:我们坚持使用Google Cloud Endpoints.根据Google Calendar API资源管理器( https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.update),应该可以在Google API资源管理器中使用java.util.Map,如下面对’extendedProperties’的’sh
我们坚持使用Google Cloud Endpoints.根据Google Calendar API资源管理器( https://developers.google.com/apis-explorer/#p/calendar/v3/calendar.events.update),应该可以在Google API资源管理器中使用java.util.Map,如下面对’extendedProperties’的’shared’属性所示:

enter image description here

但是,当我们使用Map时,它只是在API资源管理器中显示为“空”,我们无法像在Calendar API中那样添加条目:

enter image description here

这是该字段的代码:

private java.util.Map<String,String>  impactedCustomersPrivate;

public Map<String,String> getImpactedCustomersPrivate() {
    return impactedCustomersPrivate;
}

public void setImpactedCustomersPrivate(Map<String,String> impactedCustomersPrivate) {
    this.impactedCustomersPrivate = impactedCustomersPrivate;
}

类中的所有其他字段(如字符串,长整数甚至列表)都在API Explorer中按预期工作.此外,从Javascript客户端调用带有完整Map的方法是有效的,所以问题实际上只是从API资源管理器中看不到Map.

我一直在查看Calendar API Java客户端(https://developers.google.com/api-client-library/java/apis/calendar/v3/java)的源代码,他们使用Map for ExtendedProperties,请参见屏幕截图:

enter image description here

使用注释和扩展GenericJson,但没有任何帮助.

有没有人知道为什么地图没有出现在API浏览器中?不能在本地开发服务器上运行,也不在GAE上部署.使用常规POST请求或Javascript客户端库调用该方法,它可以工作.

谢谢!

解决方法

事实上,似乎Google上游的云终端内部部分是谷歌选择不共享的.与此同时,您可能/可能没有发现您仍然可以输入任意JSON数据,只是没有花哨的UI.

只需将鼠标悬停在有效负载框中出现的缺口上,然后点击“Freeform编辑器”:

这让你输入任何你该死的JSON.这是希望Google有一天可以共享他们用于UI的任何代码(以及覆盖API资源管理器中的小图标的方法).

enter image description here

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读