Facebook graph api 如何使用restFb一次获取所有嵌套对象?

Facebook graph api 如何使用restFb一次获取所有嵌套对象?,facebook-graph-api,Facebook Graph Api,因此,我可以使用以下代码获取帖子: Post post = facebookClient.fetchObject("postId", Post.class, Parameter.with("id", "message","from")); “发件人”字段返回作者的id和姓名,但不作为用户对象返回。 要获取用户对象,我必须再次发送请求: User user = facebookClient.fetchObject

因此,我可以使用以下代码获取帖子:

Post post = facebookClient.fetchObject("postId", Post.class,  Parameter.with("id", "message","from"));
“发件人”字段返回作者的id和姓名,但不作为用户对象返回。

要获取用户对象,我必须再次发送请求:

 User user = facebookClient.fetchObject(post.getFrom().getId, User.class, ..);
这会导致大量的请求调用

我能马上把它们拿来吗? 像这样:

MyPost extends Post{
    User fetchedUserWithFromFieldId;
}
并以某种方式调用:

facebookClient.fetchObject("postId", MyPost.class,  Parameter.with("id", "message","from")).deepFetch("fetchedUserWithFromFieldId",User.class, Parameter.with("link","name","location"..etc));
因此,基本上我需要与SQL的联接等效的FB。

以下是解决方案:

参数字段本身可以嵌套。
来源:章节:“带字段的请求(第三至第n级)”

facebookClient.fetchObject("postId", MyPost.class,  Parameter.with("id", "message","from{link,name,location}"));

MyPost extends Post{
    MyUser user; // MyUser has fields link,name,location.
}