io.katharsis.jpa.internal.paging.PagedRepositoryBase Maven / Gradle / Ivy
package io.katharsis.jpa.internal.paging;
import io.katharsis.queryspec.QuerySpec;
import io.katharsis.queryspec.QuerySpecMetaRepository;
import io.katharsis.response.paging.PagedResultList;
public abstract class PagedRepositoryBase implements QuerySpecMetaRepository {
@Override
public PagedMetaInformation getMetaInformation(Iterable resources, QuerySpec querySpec) {
PagedMetaInformation meta = newPagedMetaInformation();
if (resources instanceof PagedResultList) {
PagedResultList pageResultList = (PagedResultList) resources;
meta.setTotalResourceCount(pageResultList.getTotalCount());
}
return meta;
}
protected abstract PagedMetaInformation newPagedMetaInformation();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy