org.eobjects.metamodel.data
Interface DataSet

All Superinterfaces:
Closeable, Iterable<Row>
All Known Implementing Classes:
AbstractDataSet, EmptyDataSet, FilteredDataSet, FirstRowDataSet, InMemoryDataSet, MaxRowsDataSet, RowPublisherDataSet, SubSelectionDataSet

public interface DataSet
extends Closeable, Iterable<Row>

Represents a tabular DataSet where values are bound to columns and rows. A DataSet works similarly to a slightly modularized ResultSet when you traverse it - use the next() method to loop through the rows of the DataSet and use the getRow() method to get the current row.

Author:
Kasper Sørensen

Method Summary
 void close()
          Closes the DataSet and any resources it may be holding.
 Row getRow()
           
 SelectItem[] getSelectItems()
           
 int indexOf(SelectItem item)
          Finds the index of a given SelectItem
 Iterator<Row> iterator()
          Converts the DataSet into an Iterator.
 boolean next()
          Moves forward to the next row.
 List<Object[]> toObjectArrays()
          Converts the DataSet into a list of object arrays (will load all values into memory)
 List<Row> toRows()
          Converts the DataSet into a list of rows (will load all rows into memory)
 TableModel toTableModel()
          Deprecated. instantiate a new DataSetTableModel instead.
 

Method Detail

getSelectItems

SelectItem[] getSelectItems()
Returns:
the SelectItems that represent the columns of this DataSet

indexOf

int indexOf(SelectItem item)
Finds the index of a given SelectItem

Parameters:
item -
Returns:
the index (0-based) of the SelectItem or -1 if the SelectItem doesn't exist in this DataSet.

next

boolean next()
Moves forward to the next row.

Returns:
true if there is a next row or false if not.

getRow

Row getRow()
Returns:
the current row.

close

void close()
Closes the DataSet and any resources it may be holding.

Specified by:
close in interface Closeable

toTableModel

@Deprecated
TableModel toTableModel()
Deprecated. instantiate a new DataSetTableModel instead.

Converts the DataSet into a TableModel (will load all values into memory).


toObjectArrays

List<Object[]> toObjectArrays()
Converts the DataSet into a list of object arrays (will load all values into memory)


toRows

List<Row> toRows()
Converts the DataSet into a list of rows (will load all rows into memory)


iterator

Iterator<Row> iterator()
Converts the DataSet into an Iterator. Note that unlike many Iterable objects, DataSets are unlikely to allow creation of multiple iterators without risking loss of data in each individual iteration loop.

Specified by:
iterator in interface Iterable<Row>


Copyright © 2007-2013. All Rights Reserved.