Class ListResult<T>
- java.lang.Object
-
- lumis.portal.rest.util.ListResult<T>
-
- Type Parameters:
T
- the type of objects returned on this list.
- Direct Known Subclasses:
ActivityStreamResource.ActivityDocumentListResult
,CommentItResource.CommentsItemList
,CommentItResource.CommentsList
,LikeItResource.LikesItemList
,LikeItResource.LikesList
@StableMinor(version="14.0", sinceVersion="8.0") public abstract class ListResult<T> extends Object
A generic class for use as the result of a REST method returning a list of objects.When using this class, it must be extended the method
getItems()
overridden, so JAXB can correctly marshal the list item type. annotation to include the element type used in the list, so it can be marshaled correctly.After creating an instance of this class, its values may be set using
init(UriInfo, List, Integer, Integer, Integer)
or individually with set methods.- Since:
- 8.0.0
- Version:
- $Revision: 24477 $ $Date: 2021-04-28 11:30:36 -0300 (Wed, 28 Apr 2021) $
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ListResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
createFirstUrl(UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the first page of the result.protected String
createLastUrl(UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the last page of the result.protected String
createNextUrl(UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the next page of the result.protected String
createPreviousUrl(UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the previous page of the result.String
getFirstUrl()
Returns the URL the corresponds to the first page of this list.List<T>
getItems()
Returns the backing list object for this result list.String
getLastUrl()
Returns the URL the corresponds to the last page of this list.Integer
getMaxResults()
Returns the maximum number of results requested to be returned in this ListResult.String
getNextUrl()
Returns the URL the corresponds to the next page of this list.String
getPreviousUrl()
Returns the URL the corresponds to the previous page of this list.Integer
getStartAt()
Returns the index of the first result being returned in the current ListResult.Integer
getTotalCount()
Returns the total number of items that exist, although not all of them may be returned in this ListResult.void
init(UriInfo uriInfo, List<T> items, Integer totalCount, Integer maxResults, Integer startAt)
Initializes all fields of this list result based on the given information.void
setFirstUrl(String firstUrl)
Sets the URL the corresponds to the first page of this list.void
setItems(List<T> items)
Sets the backing list object for this result list.void
setLastUrl(String lastUrl)
Sets the URL the corresponds to the last page of this list.void
setMaxResults(Integer maxResults)
Sets the maximum number of results requested to be returned in this ListResult.void
setNextUrl(String nextUrl)
Sets the URL the corresponds to the next page of this list.void
setPreviousUrl(String previousUrl)
Sets the URL the corresponds to the previous page of this list.void
setStartAt(Integer startAt)
Sets the index of the first result being returned in the current ListResult.void
setTotalCount(Integer totalCount)
Sets the total number of items that exist, although not all of them may be returned in this ListResult.
-
-
-
Method Detail
-
init
public void init(UriInfo uriInfo, List<T> items, Integer totalCount, Integer maxResults, Integer startAt)
Initializes all fields of this list result based on the given information.- Parameters:
uriInfo
- information about the current requested URL.items
- a list containing the objects that are part of the result.totalCount
- the total number of existing objects (including objects not included in the current pagination), ornull
if it is unknown.maxResults
- the maximum number of results per pagination that was used when generating thedata
, ornull
if there is no pagination.startAt
- the first index (zero-based) of the objects in the current pagination, ornull
if there is no pagination.- Since:
- 8.0.0
-
getMaxResults
public Integer getMaxResults()
Returns the maximum number of results requested to be returned in this ListResult.- Returns:
- the maximum number of results requested to be returned, or
null
if there was no maximum number specified. - Since:
- 8.0.0
-
setMaxResults
public void setMaxResults(Integer maxResults)
Sets the maximum number of results requested to be returned in this ListResult.- Parameters:
maxResults
- the maximum number of results requested to be returned, ornull
if there is no maximum number specified.- Since:
- 8.0.0
-
getStartAt
public Integer getStartAt()
Returns the index of the first result being returned in the current ListResult.- Returns:
- the index zero-based, or
null
if it was not specified. - Since:
- 8.0.0
-
setStartAt
public void setStartAt(Integer startAt)
Sets the index of the first result being returned in the current ListResult.- Parameters:
startAt
- the index zero-based, ornull
if it was not specified.- Since:
- 8.0.0
-
getTotalCount
public Integer getTotalCount()
Returns the total number of items that exist, although not all of them may be returned in this ListResult.- Returns:
- the total number of items, or
null
if unknown. - Since:
- 8.0.0
-
setTotalCount
public void setTotalCount(Integer totalCount)
Sets the total number of items that exist, although not all of them may be returned in this ListResult.- Parameters:
totalCount
- the total number of items, ornull
if unknown.- Since:
- 8.0.0
-
getFirstUrl
public String getFirstUrl()
Returns the URL the corresponds to the first page of this list.- Returns:
- the URL the corresponds to the first page of this list.
- Since:
- 8.0.0
-
setFirstUrl
public void setFirstUrl(String firstUrl)
Sets the URL the corresponds to the first page of this list.- Parameters:
firstUrl
- the URL the corresponds to the first page of this list.- Since:
- 8.0.0
-
getNextUrl
public String getNextUrl()
Returns the URL the corresponds to the next page of this list.- Returns:
- the URL the corresponds to the next page of this list.
- Since:
- 8.0.0
-
setNextUrl
public void setNextUrl(String nextUrl)
Sets the URL the corresponds to the next page of this list.- Parameters:
nextUrl
- the URL the corresponds to the next page of this list.- Since:
- 8.0.0
-
getPreviousUrl
public String getPreviousUrl()
Returns the URL the corresponds to the previous page of this list.- Returns:
- the URL the corresponds to the previous page of this list.
- Since:
- 8.0.0
-
setPreviousUrl
public void setPreviousUrl(String previousUrl)
Sets the URL the corresponds to the previous page of this list.- Parameters:
previousUrl
- the URL the corresponds to the previous page of this list.- Since:
- 8.0.0
-
getLastUrl
public String getLastUrl()
Returns the URL the corresponds to the last page of this list.- Returns:
- the URL the corresponds to the last page of this list.
- Since:
- 8.0.0
-
setLastUrl
public void setLastUrl(String lastUrl)
Sets the URL the corresponds to the last page of this list.- Parameters:
lastUrl
- the URL the corresponds to the last page of this list.- Since:
- 8.0.0
-
getItems
public List<T> getItems()
Returns the backing list object for this result list.- Returns:
- the backing list object for this result list.
- Since:
- 8.0.0
-
setItems
public void setItems(List<T> items)
Sets the backing list object for this result list.- Parameters:
items
- the backing list object for this result list.- Since:
- 8.0.0
-
createFirstUrl
protected String createFirstUrl(UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the first page of the result.This method can be overridden as a way to alter the generation of the first URL without stopping to use the
init
method.- Parameters:
uriInfo
- information about the requested URI.- Returns:
- the URL the corresponds to the page of this list, or
null
if there is no first page. - Since:
- 8.0.0
-
createNextUrl
protected String createNextUrl(UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the next page of the result.This method can be overridden as a way to alter the generation of the next URL without stopping to use the
init
method.- Parameters:
uriInfo
- information about the requested URI.- Returns:
- the URL the corresponds to the page of this list, or
null
if there is no next page. - Since:
- 8.0.0
-
createPreviousUrl
protected String createPreviousUrl(UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the previous page of the result.This method can be overridden as a way to alter the generation of the previous URL without stopping to use the
init
method.- Parameters:
uriInfo
- information about the requested URI.- Returns:
- the URL the corresponds to the page of this list, or
null
if there is no previous page. - Since:
- 8.0.0
-
createLastUrl
protected String createLastUrl(UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the last page of the result.This method can be overridden as a way to alter the generation of the last URL without stopping to use the
init
method.- Parameters:
uriInfo
- information about the requested URI.- Returns:
- the URL the corresponds to the page of this list, or
null
if there is no last page. - Since:
- 8.0.0
-
-