所以,我对AWS lambda相当熟悉,但是我对为什么这对我不起作用感到困惑。
我设置了课程:
public class ClassToDeserialize {
private String token;
private String bucketName;
private String fileFormat;
private int index;
public ClassToDeserialize(String token, String bucketName, String fileFormat, int index) {
this.token = token;
this.bucketName = bucketName;
this.fileFormat = fileFormat;
this.index = index;
}
//PLUS ALL THE GETS AND SETS
}
然后在我的lambda处理程序中:
public String handleRequest(ClassToDeserialize payload, Context context) {
final Gson gson = new GsonBuilder().serializeNulls().create();
System.out.println(gson.toJson(payload));
return "done";
}
发送到此lambda的输入是这个:
{
"token": "IAMATOKEN",
"bucketName": "this-is-my-bucket",
"fileFormat": "text",
"index": 0
}
但是System.out语句显示此:
{
"token": null,
"bucketName": null,
"fileFormat": null,
"index": 0
}
有人可以向我解释为什么会这样吗?我感到非常困惑,因为我已经使用lambda了很长时间了,而且我一直都成功地使用过它。.我只是不知道现在会发生什么。
因此,我对AWS lambda十分精通,但是我对为什么这对我不起作用感到困惑。我设置了一个类:公共类ClassToDeserialize {private String token;私人...
提供的代码是正确的,您需要检查之前发生了什么以及为何具有空值的对象到达该方法。