ru.sstu.tables
Interface TableReader

All Known Implementing Classes:
CsvTableReader, XlsTableReader, XlsxTableReader

public interface TableReader

TableReader interface represents abstract table data reader.

Since:
Tables 1.0
Author:
Denis A. Murashev

Method Summary
 void addConverter(Class<?> fromClass, Class<?> toClass, Converter converter)
          Adds support for converting values from fromClass to toClass.
 Converter getConverter(Class<?> fromClass, Class<?> toClass)
          Provides converter for given types.
<T> List<T>
read(Mapping<T> mapping, InputStream input)
          Reads table data from given input stream.
<T> List<T>
read(Mapping<T> mapping, InputStream input, int tableIndex)
          Reads table data from given input stream.
 void setDateFormat(String dateFormat)
          Sets used date format.
 void skip(int count)
          Deprecated. use Mapping.setSkipRows(int) method
 

Method Detail

read

<T> List<T> read(Mapping<T> mapping,
                 InputStream input)
             throws TableException
Reads table data from given input stream.

Type Parameters:
T - type of table row
Parameters:
mapping - mapping for class and table
input - input stream for table data
Returns:
list of object read from input stream
Throws:
TableException - if cannot read data

read

<T> List<T> read(Mapping<T> mapping,
                 InputStream input,
                 int tableIndex)
             throws TableException
Reads table data from given input stream.

Type Parameters:
T - type of table row
Parameters:
mapping - mapping for class and table
input - input stream for table data
tableIndex - index of table to be read (if input stream has more then 1 table)
Returns:
list of objects read from input stream
Throws:
TableException - if cannot read data

skip

@Deprecated
void skip(int count)
          throws TableException
Deprecated. use Mapping.setSkipRows(int) method

Skips data of size count.

Parameters:
count - data to be skipped
Throws:
TableException - if cannot skip data

addConverter

void addConverter(Class<?> fromClass,
                  Class<?> toClass,
                  Converter converter)
Adds support for converting values from fromClass to toClass.

Parameters:
fromClass - from class
toClass - to class
converter - converter

getConverter

Converter getConverter(Class<?> fromClass,
                       Class<?> toClass)
                       throws TableException
Provides converter for given types.

Parameters:
fromClass - from class
toClass - to class
Returns:
converter
Throws:
TableException - if desired converter does not exist
Since:
Tables 1.1
See Also:
addConverter(Class, Class, Converter)

setDateFormat

void setDateFormat(String dateFormat)
Sets used date format.

Parameters:
dateFormat - date format
Since:
Tables 1.1
See Also:
SimpleDateFormat


Copyright © 2012 TFI branch of Engels Instutute of Technology. All Rights Reserved.