Java Paging Query Tool class

Source: Internet
Author: User

 Public classPagelist<t> {    Private intTotalpage;//Total Pages    Private intTotalCount;//Total Record Count    Private intCurrentPage;//Current Page    Private intPageSize//number of pages per page    Private intFirstPage;//first Page    Private intLastPage;//last page    Private intPrepage;//Previous Page    Private intNextPage//Next Page    Private BooleanIsprepage;//do you have a previous page    Private BooleanIsnextpage;//do you have the next page ?    Privatelist<t> result =NewArraylist<t>(); /*** Construction Method Description * *@paramresult returns results *@paramcurrentpage Current Page *@parampagesize number of pages per page *@paramtotalcount Total number of records*/     PublicPageList (list<t> result,intCurrentPage,intPageSizeinttotalcount) {         This. result =result;  This. currentpage =currentpage;  This. pagesize =pagesize;  This. TotalCount =TotalCount; if(pagesize = = 0 | | totalcount = = 0){            return ; }                if(CurrentPage < 1){               This. currentpage = 1; }                  if(totalcount% pagesize = = 0) {             This. Totalpage = TotalCount/pagesize; } Else {             This. totalpage = totalcount/pagesize + 1; }                 This. FirstPage =1;  This. LastPage =Totalpage; if( This. currentpage > 1){               This. Prepage = This. currentpage-1; }Else{               This. Prepage = 1; }                    if( This. currentpage <totalpage) {               This. nextpage = This. currentpage + 1; }Else{               This. nextpage =Totalpage; }                    if( This. currentpage <= 1){               This. Isprepage =false; }Else{               This. Isprepage =true; }                    if( This. currentpage >=totalpage) {               This. Isnextpage =false; }Else{               This. Isnextpage =true; }      }     Public intGettotalpage () {returnTotalpage; }     Public voidSettotalpage (inttotalpage) {         This. Totalpage =Totalpage; }     Public intGettotalcount () {returnTotalCount; }     Public voidSettotalcount (inttotalcount) {         This. TotalCount =TotalCount; }     Public intGetcurrentpage () {returncurrentpage; }     Public voidSetcurrentpage (intcurrentpage) {         This. currentpage =currentpage; }     Public intgetpagesize () {returnpagesize; }     Public voidSetPageSize (intpagesize) {         This. pagesize =pagesize; }     Public intGetfirstpage () {returnFirstPage; }     Public voidSetfirstpage (intfirstpage) {         This. FirstPage =FirstPage; }     Public intGetlastpage () {returnLastPage; }     Public voidSetlastpage (intlastpage) {         This. LastPage =LastPage; }     Public intGetprepage () {returnPrepage; }     Public voidSetprepage (intprepage) {         This. Prepage =Prepage; }     Public intGetnextpage () {returnnextpage; }     Public voidSetnextpage (intnextpage) {         This. nextpage =nextpage; }     Public BooleanIsisprepage () {returnIsprepage; }     Public voidSetisprepage (Booleanisprepage) {         This. Isprepage =Isprepage; }     Public BooleanIsisnextpage () {returnIsnextpage; }     Public voidSetisnextpage (Booleanisnextpage) {         This. Isnextpage =Isnextpage; }     PublicList<t>GetResult () {returnresult; }     Public voidSetresult (list<t>result) {         This. result =result; }              }

Java Paging Query Tool class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.