Pagination is a wrapper for encapsulate a list of same object in a page. This class will only do wraping work, such like indicating current page number and size of this page.
Common senario of using Pagination class is like list searching.


This class inherit from, hence its fields structure is like below:

public class Pagination extends SimplePage implements Serializable, Paginable
    protected int totalCount;
    protected int pageSize;
    protected int pageNo;
    private List<?> list;

So when do searching, server will return a page of object, to indicate current page and page size.


As you can see the pagination is nested inside a Message object as the data field. Inside the pagination object, there is a list field telling the real object retrieved from server; a totalCount indicate number of object inside th list; pageSize and pageNo represent size of each page and numebr of current page respectively.


Below is an instance of result of getting a list af threads

"status":"SUCCESS","message":"Get thread","data":{
    "tid":171, "content":"TEST CONTENT", "postTime":1443469243751, 
    "pid":{"pid":803,"title":"Test title","content":"TEST","rate":0.0,

Because there is only one object in list, the totalCount field is 1, which is very intuitive.


28 September 2015