All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.katharsis.jpa.internal.paging.PagedRepositoryBase Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
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