View Javadoc
1   /*
2    * Copyright 2004-2022 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *    https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package com.ibatis.common.util;
17  
18  import java.util.List;
19  
20  /**
21   * Interface for lists that support paging.
22   *
23   * @deprecated All paginated list features have been deprecated
24   */
25  public interface PaginatedList extends List {
26  
27    /**
28     * Returns the maximum number of items per page.
29     *
30     * @return The maximum number of items per page.
31     */
32    public int getPageSize();
33  
34    /**
35     * Is the current page the first page?.
36     *
37     * @return True if the current page is the first page or if only a single page exists.
38     */
39    public boolean isFirstPage();
40  
41    /**
42     * Is the current page a middle page (ie not first or last)?.
43     *
44     * @return True if the current page is not the first or last page, and more than one page exists (always returns false
45     *         if only a single page exists).
46     */
47    public boolean isMiddlePage();
48  
49    /**
50     * Is the current page the last page?.
51     *
52     * @return True if the current page is the last page or if only a single page exists.
53     */
54    public boolean isLastPage();
55  
56    /**
57     * Is a page available after the current page?.
58     *
59     * @return True if the next page is available
60     */
61    public boolean isNextPageAvailable();
62  
63    /**
64     * Is a page available before the current page?.
65     *
66     * @return True if the previous page is available
67     */
68    public boolean isPreviousPageAvailable();
69  
70    /**
71     * Moves to the next page after the current page. If the current page is the last page, wrap to the first page.
72     *
73     * @return True if the page changed
74     */
75    public boolean nextPage();
76  
77    /**
78     * Moves to the page before the current page. If the current page is the first page, wrap to the last page.
79     *
80     * @return True if the page changed
81     */
82    public boolean previousPage();
83  
84    /**
85     * Moves to a specified page. If the specified page is beyond the last page, wrap to the first page. If the specified
86     * page is before the first page, wrap to the last page.
87     *
88     * @param pageNumber
89     *          The page to go to
90     */
91    public void gotoPage(int pageNumber);
92  
93    /**
94     * Returns the current page index, which is a zero based integer. All paginated list implementations should know what
95     * index they are on, even if they don't know the ultimate boundaries (min/max).
96     *
97     * @return The current page
98     */
99    public int getPageIndex();
100 
101 }