org.aludratest.service.flatfile
Class FlatFileReader<E>

java.lang.Object
  extended by org.aludratest.service.file.FileStream<FlatFileReader<E>>
      extended by org.aludratest.service.flatfile.FlatFileReader<E>
Type Parameters:
E - the generic type to return as 'this'
All Implemented Interfaces:
ActionWordLibrary<FlatFileReader<E>>

public abstract class FlatFileReader<E>
extends FileStream<FlatFileReader<E>>

Parses flat files and provides each line as a Java object.

Author:
Volker Bergmann

Field Summary
 
Fields inherited from class org.aludratest.service.file.FileStream
elementType, filePath, fileService
 
Constructor Summary
FlatFileReader(String filePath, FlatFileService service)
          Constructor.
 
Method Summary
 FlatFileReader<E> addRowType(RowTypeData rowType)
          Adds a RowTypeData to the reader.
 FlatFileReader<E> close()
          Closes the reader
 FlatFileReader<E> readRow(WrappedRowData result)
          Reads a single row from the flat file and maps it to a Java object instance.
 String toString()
          Creates a string representation of the reader.
 FlatFileReader<E> verifyState()
          Verifies the state.
 
Methods inherited from class org.aludratest.service.file.FileStream
delete, waitUntilExists, waitUntilNotExists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FlatFileReader

public FlatFileReader(String filePath,
                      FlatFileService service)
Constructor.

Parameters:
filePath - the file path of the resource from which to read the formatted file content
service - The FlatFileService which will take control of the reader
Method Detail

addRowType

public FlatFileReader<E> addRowType(RowTypeData rowType)
Adds a RowTypeData to the reader.

Parameters:
rowType - a RowTypeData that recognizes one or more record types of the underlying flat file format
Returns:
a reference to 'this'

readRow

public FlatFileReader<E> readRow(WrappedRowData result)
Reads a single row from the flat file and maps it to a Java object instance.

Parameters:
result - a FlatFileBean holding the parsed data of the flat file row
Returns:
a reference to 'this'

close

public FlatFileReader<E> close()
Closes the reader

Returns:
a reference to 'this'

verifyState

public final FlatFileReader<E> verifyState()
Description copied from interface: ActionWordLibrary
Verifies the state. If the state is wrong, the implementor shall call an appropriate service method for reporting the inconsistency. GUIInteraction.wrongPageFlow(String)

Returns:
a reference to itself (this).

toString

public String toString()
Creates a string representation of the reader.

Overrides:
toString in class Object


Copyright © 2015 aludratest.org. All rights reserved.