Class ListResponse<T,R extends ListRequest>

java.lang.Object
de.digitalcollections.model.list.ListResponse<T,R>
Type Parameters:
T - object type of list items
All Implemented Interfaces:
Iterable<T>
Direct Known Subclasses:
BucketsResponse, PageResponse

public class ListResponse<T,R extends ListRequest> extends Object implements Iterable<T>
Container for list information.
  • Field Details

    • content

      protected List<T> content
    • executedSearchTerm

      protected String executedSearchTerm
    • request

      protected R extends ListRequest request
    • total

      protected long total
  • Constructor Details

    • ListResponse

      public ListResponse()
    • ListResponse

      public ListResponse(List<T> content, R request)
      Constructor with the given content and the given governing ListRequest.
      Parameters:
      content - the content of this list, must not be null.
      request - the request information, can be null.
    • ListResponse

      public ListResponse(List<T> content, R request, String executedSearchTerm)
      Constructor with the given content and the given governing ListRequest.
      Parameters:
      content - the content of this list, must not be null.
      request - the request information, can be null.
      executedSearchTerm - finally executed search term based on given search term (e.g. after escaping special characters etc.)
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getContent

      public List<T> getContent()
      Returns:
      the content as List.
    • getExecutedSearchTerm

      public String getExecutedSearchTerm()
    • getRequest

      public R getRequest()
      Returns:
      the request used to get this response
    • getSorting

      public Sorting getSorting()
      Returns:
      the sorting parameters for the ListResponse.
    • getTotalElements

      public long getTotalElements()
      Returns the total amount of elements.
      Returns:
      the total amount of elements
    • hasContent

      public boolean hasContent()
      Returns:
      whether the ListResponse has content at all.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • init

      protected void init()
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • setContent

      public void setContent(List<T> content)
      Allows to set the content (needed in case of content has to be converted/casted)
      Parameters:
      content - list of content/objects
    • setExecutedSearchTerm

      public void setExecutedSearchTerm(String executedSearchTerm)
    • setRequest

      public void setRequest(R request)
    • setTotalElements

      public void setTotalElements(long totalElements)
    • toString

      public String toString()
      Overrides:
      toString in class Object