我有以下云端点:
@ApiMethod(name = "test.insert")
public Test insertTest(final Test test)
{
// test is Test here, but not null
}
我在Android客户端上传递null作为参数:
api.test().insert(null).execute();
在后端,创建一个Test对象,其中所有字段都为null。但是对象本身并不是空的。
我知道我可以创建@Named参数@Nullable,但对于object参数,它看起来像GCE或REST不会按预期重建空对象。
答案 0 :(得分:0)
使用com.google.api.client.util.Data.isNull方法检查值是否为空。