public class

SimpleListWrapper

extends Object
implements ListWrapper<T>
java.lang.Object
   ↳ com.atlassian.jira.rest.api.expand.SimpleListWrapper<T>

Class Overview

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.

See Also
  • com.atlassian.plugins.rest.common.expand.Expandable

Summary

Protected Constructors
SimpleListWrapper(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.
Public Methods
static <T> SimpleListWrapper<T> empty()
Returns an empty SimpleListWrapper.
final ListWrapperCallback<T> getCallback()
int getMaxResults()
ListWrapperCallback<T> getPagingCallback()
Returns a ListWrapperCallback that the REST plugin can use to retrieve elements having specific indexes.
int getSize()
static <T> SimpleListWrapper<T> of(List<T> list, Integer maxResults)
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(List<T> list, Integer maxResults, int size)
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(List<T> list)
Returns a new SimpleListWrapper that is backed by the given collection.
static <T> SimpleListWrapper<T> of(T... elements)
Returns a new SimpleListWrapper that wraps the given elements.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.plugins.rest.common.expand.entity.ListWrapper

Protected Constructors

protected SimpleListWrapper (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.

Parameters
list a Collection
maxResults the maximum number of results to return to the client in one call
size the size of the data set

Public Methods

public static SimpleListWrapper<T> empty ()

Returns an empty SimpleListWrapper.

Returns
  • an empty SimpleListWrapper

public final ListWrapperCallback<T> getCallback ()

public int getMaxResults ()

public ListWrapperCallback<T> getPagingCallback ()

Returns a ListWrapperCallback that the REST plugin can use to retrieve elements having specific indexes.

Returns
  • a ListWrapperCallback

public int getSize ()

public static SimpleListWrapper<T> of (List<T> list, Integer maxResults)

Returns a new SimpleListWrapper that is backed by the given list and returns at most maxResults items to the client.

Parameters
list the backing List
maxResults the maximum number of results to return to the client in one call, or null
Returns
  • a new SimpleListWrapper

public static SimpleListWrapper<T> of (List<T> list, Integer maxResults, int size)

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.

Parameters
list the backing List
maxResults the maximum number of results to return to the client in one call
size the size of the data set
Returns
  • a new SimpleListWrapper

public static SimpleListWrapper<T> of (List<T> list)

Returns a new SimpleListWrapper that is backed by the given collection.

Parameters
list the backing Collection
Returns
  • a new SimpleListWrapper

public static SimpleListWrapper<T> of (T... elements)

Returns a new SimpleListWrapper that wraps the given elements.

Parameters
elements the elements to wrap
Returns
  • a new SimpleListWrapper

public String toString ()