play.db.helper
Class JdbcIterator<T>

java.lang.Object
  extended by play.db.helper.JdbcIterator<T>
All Implemented Interfaces:
java.io.Closeable, java.lang.Iterable<T>, java.util.Iterator<T>
Direct Known Subclasses:
JdbcWindowIterator

public class JdbcIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>, java.lang.Iterable<T>, java.io.Closeable

Iterate over a JDBC ResultSet


Field Summary
protected  JdbcResultFactory<T> factory
           
protected  java.sql.ResultSet result
           
 
Constructor Summary
JdbcIterator(java.sql.ResultSet result, java.lang.Class<T> resultClass)
           
JdbcIterator(java.sql.ResultSet result, JdbcResultFactory<T> factory)
           
 
Method Summary
 void close()
           
static void close(java.util.Iterator<?> iterator)
           
static
<U> JdbcIterator<U>
execute(SqlQuery query, java.lang.Class<U> resultClass)
           
static
<U> JdbcIterator<U>
execute(SqlQuery query, JdbcResultFactory<U> factory)
           
 boolean hasNext()
           
 java.util.Iterator<T> iterator()
           
protected  void load()
           
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected final JdbcResultFactory<T> factory

result

protected java.sql.ResultSet result
Constructor Detail

JdbcIterator

public JdbcIterator(java.sql.ResultSet result,
                    JdbcResultFactory<T> factory)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

JdbcIterator

public JdbcIterator(java.sql.ResultSet result,
                    java.lang.Class<T> resultClass)
             throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

execute

public static <U> JdbcIterator<U> execute(SqlQuery query,
                                          java.lang.Class<U> resultClass)

execute

public static <U> JdbcIterator<U> execute(SqlQuery query,
                                          JdbcResultFactory<U> factory)

close

public void close()
Specified by:
close in interface java.io.Closeable

close

public static void close(java.util.Iterator<?> iterator)

load

protected void load()

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<T>

next

public T next()
Specified by:
next in interface java.util.Iterator<T>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<T>

iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly