实施 CallbackDataProvider 时 Vaadin 14 延迟加载网格错误

Vaadin 14 Lazy Loading Grid Error on implement CallbackDataProvider

我有这样的错误:

这是我的代码:

CallbackDataProvider<AccountModel, Void> accountDataProvider = DataProvider
          .fromCallbacks(query -> accountServices.getAccountTable(
                    query.getOffset(), query.getLimit()
          ), accountServices.getAccountTableCount());

这里是服务代码:

public List<AccountModel> getAccountTable(int offset, int limit) throws JsonProcessingException, EndpointException {
    List<AccountModel> datalog = new JsonResponseReader(restMockvaEndpoint.send(new EndpointRequestBuilder()
            .method("GET")
            .resource("/account")
            .property("offset", offset)
            .property("limit", limit)
            .build()
    )).getContentTable(AccountModel.class).getData();
    return datalog;
}
    
public int getAccountTableCount() throws JsonProcessingException, EndpointException {
    int datalog = new JsonResponseReader(restMockvaEndpoint.send(new EndpointRequestBuilder()
            .method("GET")
            .resource("/account")
            .build()
    )).getContentTable(AccountModel.class).getData().size();
    return datalog;
}

似乎 getAccountTableCount() 方法的错误无法实施到 CallbackDataProvider。有什么想法吗?

谢谢。

CallbackDataProvider<AccountModel, Void> accountDataProvider = 
    DataProvider
      .fromCallbacks(
          query -> accountServices.getAccountTable(
                query.getOffset(), query.getLimit()).stream(), 
        query -> accountServices.getAccountTableCount());