Class AbstractSlice<T>
- java.lang.Object
-
- com.bellotapps.webapps_commons.persistence.repository_utils.AbstractSlice<T>
-
-
Constructor Summary
Constructors Constructor Description AbstractSlice(int number, int size, SortingData sortingData, java.util.List<T> content)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<T>content()PagingRequestfirstRequest()booleanhasContent()Indicates whether there are elements in this slice.booleanhasPrevious()Indicates whether there is a previous slice.booleanisFirst()Indicates whether this is the first slice.booleanisLast()Indicates whether this is the last slice.java.util.Optional<PagingRequest>nextRequest()intnumber()intnumberOfElements()longoffset()java.util.Optional<PagingRequest>previousRequest()PagingRequestrequestedBy()intsize()SortingDatasortingData()
-
-
-
Constructor Detail
-
AbstractSlice
public AbstractSlice(int number, int size, SortingData sortingData, java.util.List<T> content)Constructor.- Parameters:
number- Number of slice.size- Slice size.sortingData- TheSortingDatathat was used to sort contents of this slice.content- Content in this slice.
-
-
Method Detail
-
sortingData
public SortingData sortingData()
- Specified by:
sortingDatain interfaceSlice<T>- Returns:
SortingDatathat was used to sort contents of this slice.
-
numberOfElements
public int numberOfElements()
- Specified by:
numberOfElementsin interfaceSlice<T>- Returns:
- Amount of elements in the slice (can be less than the slice size if it is the last one).
-
offset
public long offset()
-
content
public java.util.List<T> content()
-
hasContent
public boolean hasContent()
Description copied from interface:SliceIndicates whether there are elements in this slice.- Specified by:
hasContentin interfaceSlice<T>- Returns:
trueif there are elements, orfalseotherwise.
-
requestedBy
public PagingRequest requestedBy()
- Specified by:
requestedByin interfaceSlice<T>- Returns:
- A
PagingRequestfrom which this slice can be requested.
-
isFirst
public boolean isFirst()
Description copied from interface:SliceIndicates whether this is the first slice.
-
firstRequest
public PagingRequest firstRequest()
- Specified by:
firstRequestin interfaceSlice<T>- Returns:
- A
PagingRequestfrom which the first slice can be requested.
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:SliceIndicates whether there is a previous slice.- Specified by:
hasPreviousin interfaceSlice<T>- Returns:
trueif there is a previous slice, orfalseotherwise.
-
previousRequest
public java.util.Optional<PagingRequest> previousRequest()
- Specified by:
previousRequestin interfaceSlice<T>- Returns:
- An
OptionalofPagingRequestfrom which the previous slice can be requested, if there is such, or empty otherwise.
-
nextRequest
public java.util.Optional<PagingRequest> nextRequest()
- Specified by:
nextRequestin interfaceSlice<T>- Returns:
- An
OptionalofPagingRequestfrom which the next slice can be requested, if there is such, or empty otherwise.
-
-