Package de.digitalcollections.model.list
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:
PageResponse
public class ListResponse<T,R extends ListRequest> extends Object implements Iterable<T>
Container for list information.
-
-
Constructor Summary
Constructors Constructor Description ListResponse()
ListResponse(List<T> content, R request)
Constructor with the given content and the given governingListRequest
.ListResponse(List<T> content, R request, String executedSearchTerm)
Constructor with the given content and the given governingListRequest
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
List<T>
getContent()
String
getExecutedSearchTerm()
R
getRequest()
Sorting
getSorting()
long
getTotalElements()
Returns the total amount of elements.boolean
hasContent()
int
hashCode()
protected void
init()
Iterator<T>
iterator()
void
setContent(List<T> content)
Allows to set the content (needed in case of content has to be converted/casted)void
setExecutedSearchTerm(String executedSearchTerm)
void
setRequest(R request)
void
setTotalElements(long totalElements)
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
executedSearchTerm
protected String executedSearchTerm
-
request
protected R extends ListRequest request
-
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 governingListRequest
.- 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 governingListRequest
.- 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
-
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.
-
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)
-
-