DataProvider.size method returns an int and I find myself to always cast longs from repositories, e.g. JPA CriteriaBuilder.count or Spring's CrudRepository.count which both returns longs.
Why not making DataProvider.size to return a long?
Some considerations of varying weight:
int with other APIs that don't accept long when querying.long would give the impression that it's a good idea to have a grid with more than 2000000 rows, whereas that is most likely quite problematic from a usability point of view.Thank you @Legioth for your considerations.
I'm pointing this out for two reasons mainly:
Stream from fetch, and Stream returns/accepts long for count, skip and limit, I'd expect consistency with the Java Stream API, i.e.DataProvider.fromCallbacks(
query -> getStream().skip(query.getOffset()).limit(query.getLimit()),
query -> getStream().count()
);
but instead I need to cast the count to int, or use Math.toIntExact.
DataProviders to integer values? It's quite limiting in my opinion, I sure have more than one use cases where I'll hit the integer limit and this would cause trouble.
Most helpful comment
Thank you @Legioth for your considerations.
I'm pointing this out for two reasons mainly:
Streamfromfetch, andStreamreturns/acceptslongforcount,skipandlimit, I'd expect consistency with the Java Stream API, i.e.but instead I need to cast the count to
int, or useMath.toIntExact.DataProviders to integer values? It's quite limiting in my opinion, I sure have more than one use cases where I'll hit the integer limit and this would cause trouble.