Package org.apache.cayenne.access.jdbc
Class DistinctResultIterator<T>
java.lang.Object
org.apache.cayenne.access.jdbc.DistinctResultIterator<T>
- All Implemented Interfaces:
- AutoCloseable,- Iterable<T>,- ResultIterator<T>
A ResultIterator that does in-memory filtering of rows to return only
 distinct rows. Distinct comparison is done by comparing ObjectIds created
 from each row. Internally DistinctResultIterator wraps another ResultIterator
 that provides the actual rows.
- Since:
- 3.0
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected booleanprotected DbEntityprotected ResultIterator<T>protected T
- 
Constructor SummaryConstructorsConstructorDescriptionDistinctResultIterator(ResultIterator<T> delegate, DbEntity defaultEntity, boolean compareFullRows) Creates new DistinctResultIterator wrapping another ResultIterator.
- 
Method SummaryModifier and TypeMethodDescriptionallRows()Returns all yet unread rows from ResultSet without closing it.voidclose()Closes underlying ResultIterator.booleanReturns true if there is at least one more record that can be read from the iterator.iterator()nextRow()Returns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.voidskipRow()Goes past current row.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliterator
- 
Field Details- 
delegate
- 
fetchedIds
- 
nextDataRow
- 
defaultEntity
- 
compareFullRowsprotected boolean compareFullRows
 
- 
- 
Constructor Details- 
DistinctResultIteratorpublic DistinctResultIterator(ResultIterator<T> delegate, DbEntity defaultEntity, boolean compareFullRows) Creates new DistinctResultIterator wrapping another ResultIterator.- Parameters:
- delegate- actual result iterator, that will be decorated by this DistinctResultIterator
- defaultEntity- an entity needed to build ObjectIds for distinct comparison.
 
 
- 
- 
Method Details- 
iterator
- 
closepublic void close()Closes underlying ResultIterator.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- ResultIterator<T>
 
- 
allRowsDescription copied from interface:ResultIteratorReturns all yet unread rows from ResultSet without closing it.- Specified by:
- allRowsin interface- ResultIterator<T>
- Since:
- 3.0
 
- 
hasNextRowpublic boolean hasNextRow()Description copied from interface:ResultIteratorReturns true if there is at least one more record that can be read from the iterator.- Specified by:
- hasNextRowin interface- ResultIterator<T>
 
- 
nextRowDescription copied from interface:ResultIteratorReturns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.- Specified by:
- nextRowin interface- ResultIterator<T>
 
- 
skipRowpublic void skipRow()Description copied from interface:ResultIteratorGoes past current row. If the row is not needed, this may save some time on data conversion.- Specified by:
- skipRowin interface- ResultIterator<T>
- Since:
- 3.0
 
 
-