问题
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