public abstract class

PagedDatabaseIterable

extends Object
implements EnclosedIterable<T>
java.lang.Object
   ↳ com.atlassian.jira.ofbiz.PagedDatabaseIterable<E, K>

Class Overview

A abstract implementation of EnclosedIterable that takes a list of ids and then pages them by opening an OfBizListIterator for each page.

This implementation supports preserving the order of the elements in the returned list but will load all the elements into memory in order to do so.

This implementation uses the DatabaseIterator but implements paging and sorting on top of it.

Summary

Public Constructors
PagedDatabaseIterable(List<K> ids)
Use where the order of the result is not important.
PagedDatabaseIterable(List<K> ids, Resolver<E, K> keyResolver)
Use where the order of the result is important.
PagedDatabaseIterable(List<K> ids, Resolver<E, K> keyResolver, int pageSize)
Use where the order of the result is important.
Public Methods
final void foreach(Consumer<E> consumer)
boolean isEmpty()
final int size()
Protected Methods
abstract OfBizListIterator createListIterator(List<K> ids)
Create a new iterator from the subset of ids.
abstract Resolver<GenericValue, E> getResolver()
Used to turn generic values into Domain objects
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.util.collect.EnclosedIterable
From interface com.atlassian.jira.util.collect.Sized

Public Constructors

public PagedDatabaseIterable (List<K> ids)

Use where the order of the result is not important.

Parameters
ids a List must not be null

public PagedDatabaseIterable (List<K> ids, Resolver<E, K> keyResolver)

Use where the order of the result is important.

Parameters
ids a List must not be null
keyResolver to get a domain object's key (ie. the element in the ids list). Null if sort order is unimportant

public PagedDatabaseIterable (List<K> ids, Resolver<E, K> keyResolver, int pageSize)

Use where the order of the result is important.

Parameters
ids a List must not be null
keyResolver to get a domain object's key (ie. the element in the ids list). Null if sort order is unimportant
pageSize the size of the pages to use

Public Methods

public final void foreach (Consumer<E> consumer)

public boolean isEmpty ()

public final int size ()

Protected Methods

protected abstract OfBizListIterator createListIterator (List<K> ids)

Create a new iterator from the subset of ids.

Parameters
ids list of ids
Returns
  • an instance of OfBizListIterator

protected abstract Resolver<GenericValue, E> getResolver ()

Used to turn generic values into Domain objects

Returns
  • a resolver