net.israfil.foundation.collections
Class IterableResultSet

java.lang.Object
  extended by net.israfil.foundation.collections.IterableResultSet
All Implemented Interfaces:
java.lang.Iterable<java.util.Map<java.lang.String,java.lang.Object>>

@Copyright(years="2006",
           owner="Israfil Consulting Services Corporation",
           license="BSD")
public class IterableResultSet
extends java.lang.Object
implements java.lang.Iterable<java.util.Map<java.lang.String,java.lang.Object>>

A simple wrapper that provides an Iterable implementation back-ended by a result-set. Allows a ResultSet to be used in a JDK 5.0 extended for-loop syntax. No result set can have more than one Iterable wrapper around it at a time. However, it is impossible for this object to know implicitly when it is no longer required (to free the reference). Therefore, when this wrapper is concluded, it should be disposed of via the dispose() method.

Author:
Christian Edward Gruber

Nested Class Summary
static class IterableResultSet.ResultSetIterator
           
 
Field Summary
protected static java.util.Map<java.sql.ResultSet,IterableResultSet> iterables
           
protected  java.lang.ref.WeakReference<java.sql.ResultSet> resultRef
           
 
Constructor Summary
IterableResultSet(java.sql.ResultSet result)
           
 
Method Summary
 void dispose()
           
 java.util.Iterator<java.util.Map<java.lang.String,java.lang.Object>> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterables

protected static final java.util.Map<java.sql.ResultSet,IterableResultSet> iterables

resultRef

protected final java.lang.ref.WeakReference<java.sql.ResultSet> resultRef
Constructor Detail

IterableResultSet

public IterableResultSet(java.sql.ResultSet result)
Method Detail

iterator

public java.util.Iterator<java.util.Map<java.lang.String,java.lang.Object>> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.util.Map<java.lang.String,java.lang.Object>>

dispose

public void dispose()


Copyright © 2003-2006 null. All Rights Reserved.