Why don't Google Cloud Endpoints Support Simple Object Return Types?

左心房为你撑大大i 提交于 2019-12-10 10:23:42

问题


Most of my methods return Strings, Integers, Booleans, etc and I bet that holds for 99% of developers, sure we sometimes return complex objects, arrays, etc. but most of the time something much simpler will do.

Why would Cloud Endpoints not support this? Thanks!


回答1:


So there are workarounds for returning "simple object types", in java you could return a StringResponse which would look something like this:

class StringResponse {
  String value;
  setter, getter... etc
}



回答2:


Because they are communicating with various programming languages that may or may not support the same data types. This is why most web API's will use something like XML or JSON as the data response type since it's standardized and parsable from any language.



来源:https://stackoverflow.com/questions/18703212/why-dont-google-cloud-endpoints-support-simple-object-return-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!