Class RestPageModel<T>

  • Type Parameters:
    T - type of page element

    public class RestPageModel<T>
    extends AbstractRestModel
    REST model representing a page resource.
    • Method Detail

      • expandable

        public static <T> RestPageModel<T> expandable​(@NotNull
                                                      @NotNull PageRequest pageRequest)
        Construct a page model for an expandable result list, without any results yet.
        Parameters:
        pageRequest - request
      • forItems

        public static <T> RestPageModel<T> forItems​(@NotNull
                                                    @NotNull PageRequest pageRequest,
                                                    @NotNull
                                                    @NotNull Iterable<T> items)
        Construct a page model for a result list.
        Parameters:
        pageRequest - request
        items - items for the page
      • forItems

        public static <T> RestPageModel<T> forItems​(@NotNull
                                                    @NotNull PageRequest pageRequest,
                                                    @NotNull
                                                    @NotNull Iterable<T> items,
                                                    boolean more)
        Construct a page model for a result list.
        Parameters:
        pageRequest - request
        items - items for the page
        more - true, if there are more results and the list is not complete
      • isMore

        public boolean isMore()
      • getStart

        public int getStart()
        Get the index this page starts from. Data obtained from the page request used to construct this response.
      • getLimit

        public int getLimit()
        Get the maximum number of items allowed/requested to be returned. Data obtained from the page request used to construct this response.
      • getResults

        @Nullable
        public @Nullable List<T> getResults()
      • setNext

        public void setNext​(@Nullable
                            @Nullable String next)
      • setPrev

        public void setPrev​(@Nullable
                            @Nullable String prev)