com.j256.ormlite.dao
Class CloseableWrappedIterableImpl<T>

java.lang.Object
  extended by com.j256.ormlite.dao.CloseableWrappedIterableImpl<T>
All Implemented Interfaces:
CloseableIterable<T>, CloseableWrappedIterable<T>, Iterable<T>

public class CloseableWrappedIterableImpl<T>
extends Object
implements CloseableWrappedIterable<T>

Class which is used to help folks use for loops but still close at the end. This is a wrapper to allow multiple threads to iterate across the same dao or the same lazy collection at the same time. See Dao.getWrappedIterable() or ForeignCollection.getWrappedIterable().

Author:
graywatson

Constructor Summary
CloseableWrappedIterableImpl(CloseableIterable<T> iterable)
           
 
Method Summary
 void close()
          This will close the last iterator returned by the Iterable.iterator() method.
 CloseableIterator<T> closeableIterator()
          Returns an iterator over a set of elements of type T which can be closed.
 CloseableIterator<T> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CloseableWrappedIterableImpl

public CloseableWrappedIterableImpl(CloseableIterable<T> iterable)
Method Detail

iterator

public CloseableIterator<T> iterator()
Specified by:
iterator in interface Iterable<T>

closeableIterator

public CloseableIterator<T> closeableIterator()
Description copied from interface: CloseableIterable
Returns an iterator over a set of elements of type T which can be closed.

Specified by:
closeableIterator in interface CloseableIterable<T>

close

public void close()
           throws SQLException
Description copied from interface: CloseableWrappedIterable
This will close the last iterator returned by the Iterable.iterator() method.

Specified by:
close in interface CloseableWrappedIterable<T>
Throws:
SQLException


This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.