Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 925
Ashish Bindal Avatar asked Jun 14 '26 22:06

Ashish Bindal


1 Answers

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

like image 108
Ashish Awasthi Avatar answered Jun 18 '26 01:06

Ashish Awasthi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!