Class ListablePage<T>

All Implemented Interfaces:
Iterable<T>, Supplier<Stream<T>>, org.springframework.data.domain.Page<T>, org.springframework.data.domain.Slice<T>, org.springframework.data.util.Streamable<T>

public class ListablePage<T> extends AbstractPageSupport<T>
The ListablePage class is a Spring Data Page implementation wrapping a List as the content for this page.
Since:
1.0.0
See Also:
  • Constructor Details

    • ListablePage

      public ListablePage(@Nullable List<T> content)
      Constructs an new instance of ListablePage initialized with the given List used as the content for this page.
      Parameters:
      content - List of elements serving as the content for this page. Guards against null by initializing the content to an empty List if the given List is null.
      See Also:
  • Method Details

    • newListablePage

      @SafeVarargs public static <T> ListablePage<T> newListablePage(@NonNull T... content)
      Factory method used to construct a new instance of ListablePage initialized with the given array, serving as the content for this page.
      Type Parameters:
      T - Class type of the elements in the array.
      Parameters:
      content - array of elements serving as the content for this page.
      Returns:
      a new ListablePage initialized with the given array for content.
      See Also:
    • newListablePage

      public static <T> ListablePage<T> newListablePage(@Nullable List<T> content)
      Factory method used to construct a new instance of ListablePage initialized with the given List, serving as the content for this page.
      Type Parameters:
      T - Class type of the elements in the List.
      Parameters:
      content - List of elements serving as the content for this page.
      Returns:
      a new ListablePage initialized with the given List for content.
      See Also:
    • hasContent

      public boolean hasContent()
      Specified by:
      hasContent in interface org.springframework.data.domain.Slice<T>
      Overrides:
      hasContent in class AbstractSliceSupport<T>
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface org.springframework.data.domain.Slice<T>
      Overrides:
      hasNext in class AbstractSliceSupport<T>
    • hasPrevious

      public boolean hasPrevious()
      Specified by:
      hasPrevious in interface org.springframework.data.domain.Slice<T>
      Overrides:
      hasPrevious in class AbstractSliceSupport<T>
    • getContent

      public List<T> getContent()
      Specified by:
      getContent in interface org.springframework.data.domain.Slice<T>
      Overrides:
      getContent in class AbstractSliceSupport<T>
    • getNumber

      public int getNumber()
      Specified by:
      getNumber in interface org.springframework.data.domain.Slice<T>
      Overrides:
      getNumber in class AbstractSliceSupport<T>
    • getSort

      public org.springframework.data.domain.Sort getSort()
      Specified by:
      getSort in interface org.springframework.data.domain.Slice<T>
      Overrides:
      getSort in class AbstractSliceSupport<T>
    • getTotalElements

      public long getTotalElements()
      Specified by:
      getTotalElements in interface org.springframework.data.domain.Page<T>
      Overrides:
      getTotalElements in class AbstractPageSupport<T>
    • getTotalPages

      public int getTotalPages()
      Specified by:
      getTotalPages in interface org.springframework.data.domain.Page<T>
      Overrides:
      getTotalPages in class AbstractPageSupport<T>
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
      Overrides:
      iterator in class AbstractSliceSupport<T>
    • map

      public <S> org.springframework.data.domain.Page<S> map(Function<? super T,? extends S> converter)
      Specified by:
      map in interface org.springframework.data.domain.Page<T>
      Specified by:
      map in interface org.springframework.data.domain.Slice<T>
      Specified by:
      map in interface org.springframework.data.util.Streamable<T>
      Overrides:
      map in class AbstractPageSupport<T>