Class EmbeddedPageHeader

  • Direct Known Subclasses:
    EmbeddedPage

    public class EmbeddedPageHeader
    extends Object
    This class inserts pagination information into the endpoints. It constructs the "page" element (number, size, totalPages, totalElements) in the HalResource for the endpoints. It also constructs the "_links" element (next, last, prev, self, first) in the HalResource for the endpoints.
    • Field Detail

      • page

        protected org.springframework.data.domain.Page page
      • totalElementsIsKnown

        protected boolean totalElementsIsKnown
      • self

        protected org.springframework.web.util.UriComponentsBuilder self
    • Constructor Detail

      • EmbeddedPageHeader

        public EmbeddedPageHeader​(org.springframework.web.util.UriComponentsBuilder self,
                                  org.springframework.data.domain.Page page,
                                  boolean totalElementsIsKnown)
      • EmbeddedPageHeader

        public EmbeddedPageHeader​(String self,
                                  org.springframework.data.domain.Page page,
                                  boolean totalElementsIsKnown)
      • EmbeddedPageHeader

        public EmbeddedPageHeader​(org.springframework.web.util.UriComponentsBuilder self,
                                  org.springframework.data.domain.Page page)
    • Method Detail

      • getPageInfo

        public Map<String,​Long> getPageInfo()
        Build the "page" element with all valid pagination information (number, size, totalPages, totalElements)
        Returns:
        Map that will be used to build the JSON of the "page" element
      • getLinks

        public Map<String,​Object> getLinks()
        Build the "_links" element with all valid pagination links (first, next, prev, last)
        Returns:
        Map that will be used to build the JSON of the "_links" element