com.atlassian.jira.ofbiz
Class DatabaseIterable

java.lang.Object
  extended by com.atlassian.jira.ofbiz.DatabaseIterable
All Implemented Interfaces:
CloseableIterable, Sized

public abstract class DatabaseIterable
extends Object
implements CloseableIterable

A abstract implementation of CloseableIterable that defers to an OfBizListIterator.

Note that the iteration order is up to the query that creates the OfBizListIterator.

This implementation is unbounded.

Since:
v3.13

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.jira.util.collect.CloseableIterable
CloseableIterable.ListResolver
 
Constructor Summary
DatabaseIterable(int size, Resolver resolver)
           
 
Method Summary
protected abstract  OfBizListIterator createListIterator()
          Create a new iterator.
 boolean isEmpty()
           
 CloseableIterator iterator()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseIterable

public DatabaseIterable(int size,
                        Resolver resolver)
Method Detail

iterator

public CloseableIterator iterator()
Specified by:
iterator in interface CloseableIterable
Returns:
a CloseableIterator that can be closed once finished with

size

public final int size()
Specified by:
size in interface CloseableIterable
Specified by:
size in interface Sized
Returns:
the likely size of the objects returned by the CloseableIterable.iterator(). Be careful depending on this size being exact, as in many cases its best efforts value or may be stable due to concurrent changes.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface CloseableIterable
Returns:
true if the there is no data behind it. In this case the CloseableIterable.iterator().hasNext() will return false;

createListIterator

protected abstract OfBizListIterator createListIterator()
Create a new iterator.

Returns:
an instance of OfBizListIterator


Copyright © 2002-2008 Atlassian. All Rights Reserved.