Class PagedResult<TEntity extends Serializable>

  • Type Parameters:
    TEntity - type of object to get a paged result for.
    All Implemented Interfaces:
    Serializable

    public final class PagedResult<TEntity extends Serializable>
    extends Object
    implements Serializable
    Model representing the result for a paged query.
    Since:
    8.2.0
    Author:
    XIMA MEDIA GmbH
    See Also:
    Serialized Form
    • Constructor Detail

      • PagedResult

        public PagedResult​(List<TEntity> result,
                           int resultCount)
    • Method Detail

      • empty

        public static <TEntity extends SerializablePagedResult<TEntity> empty()
        Returns an empty paged result.
        Type Parameters:
        TEntity - typ of the entities expected to be in the result page.
        Returns:
        an empty paged result.
      • forList

        public static <TEntity extends SerializablePagedResult<TEntity> forList​(List<TEntity> totalResults,
                                                                                  int page,
                                                                                  int pageSize)
        Returns a PagedResult for the given list of total results and paging. The result list will be return partitioned of the given total result list according to the given paging.
        Type Parameters:
        TEntity - type of object to get a paged result for.
        Parameters:
        totalResults - all results.
        page - to get. If a page less than or equal to zero is given, paging is disabled and all entities are returned in one page.
        pageSize - size of the page to get. If a page size less than zerois given, paging is disabled and all entities are returned in one page.
        Returns:
        a paged result of the given list of total results.
      • getTotalCount

        public int getTotalCount()