Class ListResponse<T,​R extends ListRequest>

  • Type Parameters:
    T - object type of list items
    All Implemented Interfaces:
    Iterable<T>
    Direct Known Subclasses:
    PageResponse

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

      • content

        protected List<T> content
      • executedSearchTerm

        protected String executedSearchTerm
      • total

        protected long total
    • Constructor Detail

      • 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 Detail

      • 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()
      • 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)