Package org.cyclos.utils
Class PageImpl<T>
- java.lang.Object
-
- org.cyclos.utils.PageImpl<T>
-
- Type Parameters:
T- The data type
- All Implemented Interfaces:
Serializable,Iterable<T>,Page<T>
public class PageImpl<T> extends Object implements Page<T>, Serializable
An implementation for aPage- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.cyclos.utils.Page
CURRENT_PAGE, DEFAULT_PAGE_SIZE, HAS_NEXT_PAGE, PAGE_COUNT, PAGE_ITEMS, PAGE_SIZE, TOTAL_COUNT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> Page<T>empty()static <T> Page<T>empty(int pageSize, int currentPage)intgetCurrentPage()Returns the number of this page within the totalIntegergetPageCount()Returns the total number of pages.List<T>getPageItems()Returns the page itemsintgetPageSize()Returns the page sizeIntegergetTotalCount()Returns the total number of records.booleanisHasNextPage()Returns whether a next page existsIterator<T>iterator()voidsetCurrentPage(int currentPage)voidsetHasNextPage(boolean hasNextPage)voidsetPageItems(List<T> pageItems)voidsetPageSize(int pageSize)voidsetTotalCount(Integer totalCount)Stream<T>stream()Returns a stream with the page itemsStringtoString()static <I,T>
Page<T>transformed(Page<I> original, Function<I,T> transformer)static <T> Page<T>withNextPage(List<T> pageItems, int pageSize, int currentPage, boolean hasNextPage)static <T> Page<T>withTotalCount(List<T> pageItems, int totalCount, int pageSize, int currentPage)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
empty
public static <T> Page<T> empty()
-
empty
public static <T> Page<T> empty(int pageSize, int currentPage)
-
withNextPage
public static <T> Page<T> withNextPage(List<T> pageItems, int pageSize, int currentPage, boolean hasNextPage)
-
withTotalCount
public static <T> Page<T> withTotalCount(List<T> pageItems, int totalCount, int pageSize, int currentPage)
-
getCurrentPage
public int getCurrentPage()
Description copied from interface:PageReturns the number of this page within the total- Specified by:
getCurrentPagein interfacePage<T>
-
getPageCount
public Integer getPageCount()
Description copied from interface:PageReturns the total number of pages. If the total count is unknown, returns null.- Specified by:
getPageCountin interfacePage<T>
-
getPageItems
public List<T> getPageItems()
Description copied from interface:PageReturns the page items- Specified by:
getPageItemsin interfacePage<T>
-
getPageSize
public int getPageSize()
Description copied from interface:PageReturns the page size- Specified by:
getPageSizein interfacePage<T>
-
getTotalCount
public Integer getTotalCount()
Description copied from interface:PageReturns the total number of records. If the total count is unknown, returns null.- Specified by:
getTotalCountin interfacePage<T>
-
isHasNextPage
public boolean isHasNextPage()
Description copied from interface:PageReturns whether a next page exists- Specified by:
isHasNextPagein interfacePage<T>
-
setCurrentPage
public void setCurrentPage(int currentPage)
-
setHasNextPage
public void setHasNextPage(boolean hasNextPage)
-
setPageSize
public void setPageSize(int pageSize)
-
setTotalCount
public void setTotalCount(Integer totalCount)
-
stream
public Stream<T> stream()
Description copied from interface:PageReturns a stream with the page items
-
-