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

com.itcoon.common.jpa.page.JpaDslPageResult Maven / Gradle / Ivy

There is a newer version: 1.1.2.RELEASE
Show newest version
package com.itcoon.common.jpa.page;

import com.itcoon.common.core.page.AbstractPageResultAdaptor;
import com.querydsl.core.QueryResults;

import java.util.List;

public class JpaDslPageResult  extends AbstractPageResultAdaptor> {

    protected JpaDslPageResult(QueryResults queryResults) {
        super(queryResults);
    }

    @Override
    public List getContents() {
        return getPage().getResults();
    }

    @Override
    public Integer getPageNo() {
        if(getPage().getTotal() % getPageSize() == 0){
            return (int)(getPage().getTotal() / getPageSize());
        }
        return (int)(getPage().getTotal() / getPageSize()) + 1;
    }

    @Override
    public Integer getPageSize() {
        QueryResults queryResults = getPage();
        return (int)queryResults.getLimit() - (int)queryResults.getOffset();
    }

    @Override
    public Long getTotal() {
        return getPage().getTotal();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy