Pager.java
pacote pers.kangxu.datautils.common; importar java.io.serializable; importar java.util.list;/** * * <b> classe geral de paginação </b> * * @author kangxu * @param <T> * */public classe PAGER <T> Seratic Seraticable { 4542617637761955078L; / *** Página atual da página de corrente*/ private int currentPage = 1; / *** PageSize por tamanho da página*/ private int PageSize = 10; / *** Número Pagetotal de Páginas*/ Private Int Pagetotal; / *** Número Total de peças*/ Private Int RecordTotal = 0; / *** Página anterior anterior*/ private int anteriorPage; / *** NextPage Próxima página*/ Private int NextPage; / *** Primeira página da primeiraPAGE*/ private int FirstPage = 1; / *** última página da página*/ private int lastpage; / *** Conteúdo do conteúdo de cada página*/ Lista privada <T> Conteúdo; // O seguinte método de conjunto requer atribuição/ ** * Defina a página atual <br> * * @author kangxu * * @param currentPage */ public void setCurrentPage (int currentPage) {this.currentpage = currentpage; } /*** Defina o tamanho de cada página, você também não precisa atribuir valores. O tamanho padrão é de 10 itens <br> * * @author kangxu * * @param pagageSize */ public void setPagesize (int paGageSize) {this.Pagesize = Pagesize; } / ** * Defina o número total de itens, o padrão é 0 <br> * * @author kangxu * * @param registroTotal * / public void setRecordTotal (int registrTotal) {this.recordTotal = registroTotal; outrotattr (); } / ** * Defina o conteúdo da página <br> * * @author kangxu * * @param content * / public void setContent (list <t> content) {this.content = content; } / ** * Defina outros parâmetros * * @Author Kangxu * * / public void OtherAtattr () {// Número total de páginas this.PageTotal = this.RecordTotal % this.Pagesize> 0? this.RecordTotal / this.Pagesize + 1: this.RecordTotal / this.Pagesize; // primeira página this.firstpage = 1; // última página this.lastpage = this.Pagetotal; // página anterior if (this.currentpage> 1) {this.previouspage = this.currentPage - 1; } else {this.previouspage = this.firstpage; } // Próxima página if (this.currentPage <this.lastpage) {this.NextPage = this.currentPage + 1; } else {this.NextPage = this.lastPage; }} // Deixe de lado os atributos privados public int getCurrentPage () {return CurrentPage; } public int getPagesize () {return pagageSize; } public int getPagetotal () {return pagetotal; } public int getRecordTotal () {return registrtotal; } public int getPreviousPage () {return anteriorpage; } public int getNextPage () {return NextPage; } public int getfirstpage () {return FirstPage; } public int getLastPage () {return lastPage; } Lista pública <T> getContent () {return Content; } @Override public String toString() { return "Pager [currentPage=" + currentPage + ", pageSize=" + pageSize + ", pageTotal=" + pageTotal + ", recordTotal=" + recordTotal + ", previousPage=" + previousPage + ", nextPage=" + nextPage + ", firstPage=" + firstPage + ", lastPage=" + lastPage + ", content =" + content + "]"; }}Usando Pagertester.java
pacote pers.kangxu.datautils.utils; importar java.util.ArrayList; importar java.util.list; importar pers.kangxu.datautils.common.pager;/** ** ** Paginth Data Teste * <b> * * * * @author kangxu * * */public Data Pagester Pagester Pagester * * @author; Pager <tring> pager = new Pager <string> (); List <String> content = new ArrayList <String> (); content.add ("str1"); content.add ("str2"); content.add ("str3"); content.add ("str4"); content.add ("str5"); content.add ("str6"); content.add ("str7"); content.add ("str8"); content.add ("str9"); content.add ("str10"); pager.setCurrentPage (1); pager.SetPagesize (10); pager.SetRecordTotal (62); pager.setContent (conteúdo); System.out.println (pager); }}O exposto acima é todo o conteúdo deste artigo. Espero que o conteúdo deste artigo seja de ajuda para estudar ou trabalhar de todos. Eu também espero apoiar mais wulin.com!