Ashish Bindal
Ashish Bindal

Reputation: 995

Google Cloud Endpoints: Return type of api method

In google cloud endpoints api class, I have following error while generating client endpoint library for android client:

java.lang.IllegalArgumentException: Type class java.lang.Boolean cannot be used as a return type

I have tried with other generic types as well, I guess api method can't return any generic object. I can't figure it out why this is not allowed in api method?

Is there any hack of this limitation?

/**
 * Returning error during client endpoint generation.
 */

@ApiMethod(name = "isValidEntity")
public Boolean isValidEntity(BusinessAccount businessAccount) {
    EntityManager mgr = getEntityManager();
    Boolean isValid = false;
    try{
       .....
       ....
    } finally {
        mgr.close();
    }
    return isValid;
}

PS: I couldn't find enough documentation on api annotations other than Getting Started: cloud endpoint google documentation. I will appreciate if someone can point me to relevant sources.

Upvotes: 3

Views: 2228

Answers (1)

Ashish Awasthi
Ashish Awasthi

Reputation: 1327

GPE docs say, "In the Endpoint methods, the return value type cannot be simple type such as String or int. The return value needs to be a POJO, an array or a Collection."

https://developers.google.com/eclipse/docs/endpoints-addentities

Upvotes: 5

Related Questions