Package io.micronaut.data.model
Interface Slice<T>
- Type Parameters:
- T- The generic type
- All Superinterfaces:
- Iterable<T>
- All Known Subinterfaces:
- Page<T>
@DefaultImplementation(io.micronaut.data.model.DefaultSlice.class)
public interface Slice<T>
extends Iterable<T>
Inspired by the Spring Data's 
Slice and GORM's PagedResultList, this models a type that supports
 pagination operations.
 A slice is a result list associated with a particular Pageable
- Since:
- 1.0.0
- Author:
- graemerocher
- 
Method SummaryModifier and TypeMethodDescriptiondefault intdefault long@NonNull Pageabledefault intdefault intgetSize()default @NonNull SortgetSort()default booleanisEmpty()iterator()default <T2> @NonNull Slice<T2>Maps the content with the given function.default @NonNull Pageablestatic <T2> @NonNull Slice<T2>Creates a slice from the given content and pageable.default @NonNull PageableMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Method Details- 
getContent- Returns:
- The content.
 
- 
getPageable- Returns:
- The pageable for this slice.
 
- 
getPageNumberdefault int getPageNumber()- Returns:
- The page number
 
- 
nextPageable- Returns:
- The next pageable
 
- 
previousPageable- Returns:
- The previous pageable.
 
- 
getOffsetdefault long getOffset()- Returns:
- The offset.
 
- 
getSizedefault int getSize()- Returns:
- The size of the slice.
 
- 
isEmptydefault boolean isEmpty()- Returns:
- Whether the slice is empty
 
- 
getSort- Returns:
- The sort
 
- 
getNumberOfElementsdefault int getNumberOfElements()- Returns:
- The number of elements
 
- 
iterator
- 
mapMaps the content with the given function.- Type Parameters:
- T2- The type returned by the function
- Parameters:
- function- The function to apply to each element in the content.
- Returns:
- A new slice with the mapped content
 
- 
of@NonNull static <T2> @NonNull Slice<T2> of(@NonNull @NonNull List<T2> content, @NonNull @NonNull Pageable pageable) Creates a slice from the given content and pageable.- Type Parameters:
- T2- The generic type
- Parameters:
- content- The content
- pageable- The pageable
- Returns:
- The slice
 
 
-