org.aludratest.service.separatedfile
Class SeparatedFileReader<B extends SeparatedFileBeanData,R extends SeparatedFileReader<B,R>>

java.lang.Object
  extended by org.aludratest.service.file.FileStream<R>
      extended by org.aludratest.service.separatedfile.SeparatedFileReader<B,R>
Type Parameters:
R - the generic type to return as 'this'
B -
All Implemented Interfaces:
ActionWordLibrary<R>

public abstract class SeparatedFileReader<B extends SeparatedFileBeanData,R extends SeparatedFileReader<B,R>>
extends FileStream<R>

Parses separated 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
SeparatedFileReader(String filePath, SeparatedFileService service, Class<? extends SeparatedFileBeanData> beanClass, char separator)
          Constructor.
 
Method Summary
 R close()
          Closes the reader
protected  R readHeader(StringData result)
           
protected  R readRow(WrappedSeparatedData<B> data)
          Reads a single row from the separated file and maps it to a Java object instance.
 String toString()
          Creates a string representation of the reader.
 R 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

SeparatedFileReader

public SeparatedFileReader(String filePath,
                           SeparatedFileService service,
                           Class<? extends SeparatedFileBeanData> beanClass,
                           char separator)
Constructor.

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

readRow

protected R readRow(WrappedSeparatedData<B> data)
Reads a single row from the separated file and maps it to a Java object instance.

Parameters:
data - a SeparatedFileBean holding the parsed data of the separated file row
Returns:
a reference to 'this'

readHeader

protected R readHeader(StringData result)

close

public R close()
Closes the reader

Returns:
a reference to 'this'

verifyState

public R 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.