com.univocity.api.entity
Interface Entity


public interface Entity

A data entity managed by uniVocity. It provides a consistent abstraction for accessing records from any source of data. Instances of this interface must be obtained from DataIntegrationEngine through DataIntegrationEngine.getEntity(String)

Author:
uniVocity Software Pty Ltd - dev@univocity.com

Method Summary
 void beginReading(String... fieldNames)
          Start iterating over the records of this data entity.
 Object[] getCurrentRow()
          Returns the current row read from the input.
 String getEntityName()
          Returns the name of this data entity
 int indexOf(String fieldName)
          Returns the position of a given field in the current row.
 Object[] readNext()
          Reads the next record stored by this data entity.
 void stopReading()
          Stops the active reading process created by the beginReading(String...) method.
 Object valueOf(String fieldName)
          Returns the value of a given field in the current row.
<T> T
valueOf(String fieldName, Class<T> type)
          Returns the value of a given field in the current row.
 

Method Detail

beginReading

void beginReading(String... fieldNames)

Start iterating over the records of this data entity. uniVocity will start a ReadingProcess in the background which will block when the number of rows loaded in memory reaches the specified limit specified by the parent data store.

If you do not intend to read all rows, invoke the stopReading() method to stop the background ReadingProcess and clear up rows loaded but not yet processed.

Parameters:
fieldNames - the fields to be read from the given data entity. Each row returned by the readNext() method will organize the values in this specified order. If no names are given, all fields will be read from the entity.

readNext

Object[] readNext()
Reads the next record stored by this data entity.

Returns:
the next row read from the underlying data entity.

stopReading

void stopReading()
Stops the active reading process created by the beginReading(String...) method.


valueOf

Object valueOf(String fieldName)
Returns the value of a given field in the current row.

Parameters:
fieldName - name of the field whose value will be returned.
Returns:
the value of the field in the current row.

valueOf

<T> T valueOf(String fieldName,
              Class<T> type)
Returns the value of a given field in the current row.

Type Parameters:
T - type expected type of the value stored by the given field
Parameters:
fieldName - name of the field whose value will be returned.
type - expected type of the value stored by the given field
Returns:
the value of the field in the current row.

indexOf

int indexOf(String fieldName)
Returns the position of a given field in the current row.

Parameters:
fieldName - name of the field whose value will be returned.
Returns:
the position of the field in the current row.

getCurrentRow

Object[] getCurrentRow()
Returns the current row read from the input.

Returns:
the current row read from the input, or null if the reading process has not begun or has been stopped

getEntityName

String getEntityName()
Returns the name of this data entity

Returns:
the name of this data entity


Copyright © 2015 uniVocity Software Pty Ltd. All rights reserved.