3

在 google cloud endpoints api 类中,为 android 客户端生成客户端端点库时出现以下错误:

java.lang.IllegalArgumentException:类型类 java.lang.Boolean 不能用作返回类型

我也尝试过其他泛型类型,我猜 api 方法不能返回任何泛型对象。我不明白为什么在 api 方法中不允许这样做?

这个限制有什么破解吗?

/**
 * 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:除了Getting Started: cloud endpoint google documentation之外,我找不到足够的关于 api 注释的文档。如果有人可以向我指出相关来源,我将不胜感激。

4

1 回答 1

5

GPE 文档说,“在 Endpoint 方法中,返回值类型不能是 String 或 int 等简单类型。返回值需要是 POJO、数组或集合。”

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

于 2013-08-31T14:54:00.700 回答