1
2
3
4
5
6
7
8
9
10
11
12
13 package com.geekologue.md4j.dao;
14
15 import java.io.Serializable;
16 import java.util.List;
17 import java.util.Map;
18
19 /***
20 * Instances of this class are created by DAOs when "paged" results are requested.
21 * The created instance contains a page of results matching a query, along with other information
22 * such as the number of the page, the number of results per page, the total number of results etc.
23 */
24 public interface Page extends Serializable {
25 /***
26 * @return Returns the total number of results the query can return, of
27 * which this page instance contains a subset.
28 */
29 public abstract int getTotalResultCount();
30
31 /***
32 * Get the total number of pages that can be used to divide the total
33 * results using the current page size.
34 *
35 * @return the total number of pages
36 */
37 public abstract int getTotalPageCount();
38
39 /***
40 * See if this page is the first
41 *
42 * @return true if first, false otherwise
43 */
44 public abstract boolean isFirst();
45
46 /***
47 * See if this page is the last
48 *
49 * @return true if last, false otherwise
50 */
51 public abstract boolean isLast();
52
53 /***
54 * Get the page of results as the list
55 *
56 * @return the list containing the results for this page
57 */
58 public abstract List getList();
59
60 /***
61 * Set the list of results for this page. You may want to use this method
62 * after processing the list obtained via <a href="#getList()"><code>getList()</code></a>
63 *
64 * @param list
65 * the list of results to set for this page
66 */
67 public abstract void setList(List list);
68
69 /***
70 * Get the page number
71 *
72 * @return the page number as given to the constructor
73 */
74 public abstract int getPageNumber();
75
76 /*** Get the index of the first result in the page */
77 public int getFirstResultIndex();
78
79 public Map getParentOptions();
80 }