|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cayenne.access.util.DistinctResultIterator
public class DistinctResultIterator
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. The current limitation is that once switched to reading ids instead of rows (i.e. when "nextObjectId()" is called for the first time), it can't be used to read data rows again. This is pretty sensible for most things in Cayenne.
| Field Summary | |
|---|---|
protected boolean |
compareFullRows
|
protected DbEntity |
defaultEntity
|
protected Set |
fetchedIds
|
protected Map |
nextDataRow
|
protected boolean |
readingIds
|
protected ResultIterator |
wrappedIterator
|
| Constructor Summary | |
|---|---|
DistinctResultIterator(ResultIterator wrappedIterator,
DbEntity defaultEntity,
boolean compareFullRows)
Creates new DistinctResultIterator wrapping another ResultIterator. |
|
| Method Summary | |
|---|---|
void |
close()
CLoses underlying ResultIterator. |
List |
dataRows(boolean close)
Returns all data rows. |
int |
getDataRowWidth()
Returns the number of columns in the result row. |
boolean |
hasNextRow()
Returns true if there is at least one more record that can be read from the iterator. |
Map |
nextDataRow()
Returns the next result row as a Map. |
Map |
nextObjectId(DbEntity entity)
Returns a Map for the next ObjectId. |
void |
skipDataRow()
Skips current data row instead of reading it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ResultIterator wrappedIterator
protected Set fetchedIds
protected Map nextDataRow
protected DbEntity defaultEntity
protected boolean compareFullRows
protected boolean readingIds
| Constructor Detail |
|---|
public DistinctResultIterator(ResultIterator wrappedIterator,
DbEntity defaultEntity,
boolean compareFullRows)
throws CayenneException
wrappedIterator - defaultEntity - an entity needed to build ObjectIds for distinct comparison.
CayenneException| Method Detail |
|---|
public void close()
throws CayenneException
close in interface ResultIteratorCayenneException
public List dataRows(boolean close)
throws CayenneException
dataRows in interface ResultIteratorCayenneExceptionpublic int getDataRowWidth()
ResultIterator
getDataRowWidth in interface ResultIterator
public boolean hasNextRow()
throws CayenneException
ResultIterator
hasNextRow in interface ResultIteratorCayenneException
public Map nextDataRow()
throws CayenneException
ResultIterator
nextDataRow in interface ResultIteratorCayenneException
public Map nextObjectId(DbEntity entity)
throws CayenneException
nextObjectId in interface ResultIteratorCayenneException
public void skipDataRow()
throws CayenneException
ResultIterator
skipDataRow in interface ResultIteratorCayenneException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||