Class PagedModel<T>

java.lang.Object
com.broadleafcommerce.search.api.domain.PagedModel<T>
Direct Known Subclasses:
SearchResponse

public class PagedModel<T> extends Object
Broadleaf: Copy of Spring Data concept for possible use earlier than spring data commons 3.3.x DTO to build stable JSON representations of a Spring Data Page. It can either be selectively used in controller methods by calling new PagedModel<>(page) or generally activated as representation model for PageImpl instances by setting EnableSpringDataWebSupport's pageSerializationMode to EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO.
Author:
Oliver Drotbohm, Greg Turnquist
  • Constructor Details

    • PagedModel

      public PagedModel(org.springframework.data.domain.Page<T> page, org.springframework.data.domain.Pageable pageable)
      Creates a new PagedModel for the given Page.
      Parameters:
      page - must not be null.
  • Method Details

    • getContent

      public List<T> getContent()
    • getSize

      public int getSize()
    • getNumber

      public int getNumber()
    • getNumberOfElements

      public int getNumberOfElements()
    • isFirst

      public boolean isFirst()
    • isLast

      public boolean isLast()
    • getTotalElements

      public long getTotalElements()
    • getTotalPages

      public long getTotalPages()
    • isEmpty

      public boolean isEmpty()
    • getMetadata

      @Nullable public PagedModel.PageMetadata getMetadata()
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object