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="17.0", sinceVersion="8.0") public abstract class ListResult<T> extends java.lang.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$ $Date$
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ListResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
createFirstUrl(javax.ws.rs.core.UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the first page of the result.protected java.lang.String
createLastUrl(javax.ws.rs.core.UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the last page of the result.protected java.lang.String
createNextUrl(javax.ws.rs.core.UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the next page of the result.protected java.lang.String
createPreviousUrl(javax.ws.rs.core.UriInfo uriInfo)
Method called byinit(UriInfo, List, Integer, Integer, Integer)
for generating the URL that corresponds to the previous page of the result.java.lang.String
getFirstUrl()
Returns the URL the corresponds to the first page of this list.java.util.List<T>
getItems()
Returns the backing list object for this result list.java.lang.String
getLastUrl()
Returns the URL the corresponds to the last page of this list.java.lang.Integer
getMaxResults()
Returns the maximum number of results requested to be returned in this ListResult.java.lang.String
getNextUrl()
Returns the URL the corresponds to the next page of this list.java.lang.String
getPreviousUrl()
Returns the URL the corresponds to the previous page of this list.java.lang.Integer
getStartAt()
Returns the index of the first result being returned in the current ListResult.java.lang.Integer
getTotalCount()
Returns the total number of items that exist, although not all of them may be returned in this ListResult.void
init(javax.ws.rs.core.UriInfo uriInfo, java.util.List<T> items, java.lang.Integer totalCount, java.lang.Integer maxResults, java.lang.Integer startAt)
Initializes all fields of this list result based on the given information.void
setFirstUrl(java.lang.String firstUrl)
Sets the URL the corresponds to the first page of this list.void
setItems(java.util.List<T> items)
Sets the backing list object for this result list.void
setLastUrl(java.lang.String lastUrl)
Sets the URL the corresponds to the last page of this list.void
setMaxResults(java.lang.Integer maxResults)
Sets the maximum number of results requested to be returned in this ListResult.void
setNextUrl(java.lang.String nextUrl)
Sets the URL the corresponds to the next page of this list.void
setPreviousUrl(java.lang.String previousUrl)
Sets the URL the corresponds to the previous page of this list.void
setStartAt(java.lang.Integer startAt)
Sets the index of the first result being returned in the current ListResult.void
setTotalCount(java.lang.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(javax.ws.rs.core.UriInfo uriInfo, java.util.List<T> items, java.lang.Integer totalCount, java.lang.Integer maxResults, java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.util.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(java.util.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 java.lang.String createFirstUrl(javax.ws.rs.core.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 java.lang.String createNextUrl(javax.ws.rs.core.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 java.lang.String createPreviousUrl(javax.ws.rs.core.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 java.lang.String createLastUrl(javax.ws.rs.core.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
-
-