Im using Google App Engine Cloud Endpoints and Im trying to receive a collection parameter . Not sure if I can do this. I know I can return a List or any Collection.
This:
public List<Pair> initializationSetup(Pair pPair){}
Works fine, but If I try to receive a list of pairs, the .api file is not created.
public List<Pair> initializationSetup(List<Pair> pPairs){
Thanks
Cloud Endpoints only deals with classes having the bean standard.
So, I created a new class named ObjectListContainer:
public class ObjectListContainer {
public List<Object> getObjectsList() {
return ObjectsList;
}
public void setObjectsList(List<Object> objectsList) {
ObjectsList = objectsList;
}
private List<Object> ObjectsList;
}
Same problem if you are trying to return a String, you can't. You have to make a StringContainer.
I have used a similar solution after think during long hours . Try this:
public class JsonList<T> {
private List<T> listItens;
public List<T> getListItens() {
return listItens;
}
public void setListItens(List<T> listItens) {
this.listItens = listItens;
}}
and in your method:
@ApiMethod(
name = "name",
path = "path",
httpMethod = ApiMethod.HttpMethod.POST)
public CollectionResponse<Information> getInformation(JsonList<String> listOfItens) {}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With