info.informatica.data
Class ListDataset

java.lang.Object
  extended by info.informatica.data.AbstractDataset
      extended by info.informatica.data.GenericDataset
          extended by info.informatica.data.ListDataset
All Implemented Interfaces:
Dataset

public final class ListDataset
extends GenericDataset

A Dataset backed by a List.

Author:
amengual at informatica dot info

Constructor Summary
ListDataset(Collection<String> column_names)
           
ListDataset(List<String> column_names)
           
ListDataset(List<String> column_names, int capacity)
           
ListDataset(ResultsetDataset ds)
           
ListDataset(ResultsetDataset ds, int capacity)
          Copy constructor with a ResultsetDataset.
 
Method Summary
 void add(Object o)
          Convenience method that adds a row composed by a single object.
 void add(Object[] o)
           
 void add(Object first, Object second)
          Convenience method that adds a row composed by a two objects.
 void addAll(Collection<Object> coll)
           
 void close()
          Closes the Dataset.
 Map<FieldName,Object> getMap()
          Gets a name-> values map containing the current data row.
 boolean isAfterLast()
          Retrieves wether the dataset is after its last row.
 boolean isEmpty()
           
 boolean isLast()
          Retrieves wether the dataset is on its last row.
 boolean next()
          Positions the Dataset at the next row of data.
 void reset()
          Puts the Dataset cursor in the initial state, regardless of the current cursor state.
 
Methods inherited from class info.informatica.data.GenericDataset
getDate, getDate, getDouble, getDouble, getInt, getInt, getLong, getLong, getMetaData, getNestedSet, getObject, getObject, getString, getString, setMetaData
 
Methods inherited from class info.informatica.data.AbstractDataset
evaluate, findColumn, getCatalogName, getColumnCount, getColumnName, getEnviron, getLabel, setEnviron, setLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListDataset

public ListDataset(List<String> column_names)

ListDataset

public ListDataset(Collection<String> column_names)

ListDataset

public ListDataset(List<String> column_names,
                   int capacity)

ListDataset

public ListDataset(ResultsetDataset ds)
            throws DatasetException
Throws:
DatasetException

ListDataset

public ListDataset(ResultsetDataset ds,
                   int capacity)
            throws DatasetException
Copy constructor with a ResultsetDataset.

In some circumstances it is good to copy a ResultsetDataset to a ListDataset, to remove dependencies with the SQL connection or to be able to dynamically add new rowsets.

Throws:
DatasetException
Method Detail

addAll

public void addAll(Collection<Object> coll)

add

public void add(Object[] o)

add

public void add(Object o)
Convenience method that adds a row composed by a single object.


add

public void add(Object first,
                Object second)
Convenience method that adds a row composed by a two objects.


isEmpty

public boolean isEmpty()
                throws DatasetException
Returns:
true if the Dataset is empty, false otherwise.
Throws:
DatasetException

next

public boolean next()
             throws DatasetException
Description copied from interface: Dataset
Positions the Dataset at the next row of data.

Specified by:
next in interface Dataset
Overrides:
next in class AbstractDataset
Returns:
false if there were no more rows, true otherwise.
Throws:
DatasetException - if the data repository produced an error.

isAfterLast

public boolean isAfterLast()
                    throws DatasetException
Description copied from interface: Dataset
Retrieves wether the dataset is after its last row.

Returns:
true if the dataset is after its last row, false otherwise.
Throws:
DatasetException - if the data repository produced an error.

isLast

public boolean isLast()
               throws DatasetException
Description copied from interface: Dataset
Retrieves wether the dataset is on its last row.

Evaluation of this method could be expensive.

Returns:
true if the dataset is on its last row, false otherwise.
Throws:
DatasetException - if the data repository produced an error.

reset

public void reset()
           throws DatasetException
Description copied from interface: Dataset
Puts the Dataset cursor in the initial state, regardless of the current cursor state.

This method allows the reuse of a Dataset object after all rows have been extracted by the use of the next() function.

This method is optional. Implementations are required to throw an UnsupportedOperationException in case they do not implement it.

Throws:
DatasetException - if an error happened when resetting the data.

close

public void close()
           throws DatasetException
Description copied from interface: Dataset
Closes the Dataset.

No further work is possible with the Dataset after closing it.

Specified by:
close in interface Dataset
Overrides:
close in class GenericDataset
Throws:
DatasetException - if an error happens when closing the Dataset.

getMap

public Map<FieldName,Object> getMap()
                             throws DatasetException
Gets a name-> values map containing the current data row.

Specified by:
getMap in interface Dataset
Overrides:
getMap in class GenericDataset
Returns:
a Map with the current data row. Cannot return null.
Throws:
DatasetException - if an error happens when creating the Map.