Class SimpleListWrapper<T>
java.lang.Object
com.atlassian.jira.rest.api.expand.SimpleListWrapper<T>
- All Implemented Interfaces:
com.atlassian.plugins.rest.api.expand.listwrapper.ListWrapper<T>
public class SimpleListWrapper<T>
extends Object
implements com.atlassian.plugins.rest.api.expand.listwrapper.ListWrapper<T>
This is a list wrapper that works by wrapping a java.util.Collection that has been eagerly loaded into memory. As
such, it does not take full advantage of the "expandable" concepts since it requires callers to have previously
loaded the entire data set into memory, but it has the advantage of being simple to implement.
This class makes a shallow copy of the wrapped collection.
- Since:
- v4.2
- See Also:
-
Expandable
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSimpleListWrapper(List<T> list, Integer maxResults, int size) Creates a new SimpleListWrapper backed by the given list and returns at most maxResults items to the client. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> SimpleListWrapper<T>empty()Returns an empty SimpleListWrapper.final com.atlassian.plugins.rest.api.expand.listwrapper.ListWrapperCallback<T>com.atlassian.plugins.rest.api.expand.listwrapper.ListWrapperCallback<T>Returns a ListWrapperCallback that the REST plugin can use to retrieve elements having specific indexes.intgetSize()static <T> SimpleListWrapper<T>Returns a new SimpleListWrapper that is backed by the given collection.static <T> SimpleListWrapper<T>Returns a new SimpleListWrapper that is backed by the given list and returns at most maxResults items to the client.static <T> SimpleListWrapper<T>Returns a new SimpleListWrapper that is backed by the given list and returns at most maxResults items to the client.static <T> SimpleListWrapper<T>of(T... elements) Returns a new SimpleListWrapper that wraps the given elements.toString()
-
Constructor Details
-
SimpleListWrapper
Creates a new SimpleListWrapper backed by the given list and returns at most maxResults items to the client.- Parameters:
list- a CollectionmaxResults- the maximum number of results to return to the client in one callsize- the size of the data set
-
-
Method Details
-
empty
Returns an empty SimpleListWrapper.- Type Parameters:
T- the type of the list element- Returns:
- an empty SimpleListWrapper
-
of
Returns a new SimpleListWrapper that wraps the given elements.- Type Parameters:
T- the type of the list element- Parameters:
elements- the elements to wrap- Returns:
- a new SimpleListWrapper
-
of
Returns a new SimpleListWrapper that is backed by the given collection.- Type Parameters:
T- the type of the list element- Parameters:
list- the backing Collection- Returns:
- a new SimpleListWrapper
-
of
Returns a new SimpleListWrapper that is backed by the given list and returns at most maxResults items to the client.- Type Parameters:
T- the type of the list element- Parameters:
list- the backing ListmaxResults- the maximum number of results to return to the client in one call, or null- Returns:
- a new SimpleListWrapper
-
of
Returns a new SimpleListWrapper that is backed by the given list and returns at most maxResults items to the client. The size attribute will contain the provided value, instead of the actual size of the passed-in list.- Type Parameters:
T- the type of the list element- Parameters:
list- the backing ListmaxResults- the maximum number of results to return to the client in one callsize- the size of the data set- Returns:
- a new SimpleListWrapper
-
getPagingCallback
Returns a ListWrapperCallback that the REST plugin can use to retrieve elements having specific indexes.- Returns:
- a ListWrapperCallback
-
getSize
public int getSize() -
getMaxResults
-
getCallback
- Specified by:
getCallbackin interfacecom.atlassian.plugins.rest.api.expand.listwrapper.ListWrapper<T>
-
toString
-