olg.csv.bean
Class BeanReader<E>
java.lang.Object
olg.csv.bean.BeanReader<E>
- Type Parameters:
E
- object this reader return
- All Implemented Interfaces:
- Closeable, Iterator<E>
public class BeanReader<E>
- extends Object
- implements Iterator<E>, Closeable
Class specialized in reading objects from a file. Used a IReader
to
read file as iterator of list of Strings. Used a BeanProcessor to transform a
list of strings returned by the reader into a new object.
- Author:
- Olivier Godineau
- See Also:
IReader
,
BeanProcessor
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BeanReader
public BeanReader(File configFile,
IReader reader)
throws LoadException
- Parameters:
configFile
- the file which describes how to load the transformer used to
transform list of String into new object. Must be not
null
.reader
- the reader to use. allows to iterate list of Strings from the
file the reader deals. Must be not null
.
- Throws:
LoadException
- if an error occurs during loading transformer from file
BeanReader
public BeanReader(File configFile,
IReader reader,
boolean skipEmptyRow)
throws LoadException
- Parameters:
configFile
- the file which describe how to load the transformer used to
transform list of String into new object. Must be not
null
.reader
- the reader to use. allows to iterate list of Strings from the
file the reader deals. Must be not null
.skipEmptyRow
- avoids reading blank lines and skip creating beans from them
- Throws:
LoadException
- if an error occurs during loading transformer from file
BeanReader
public BeanReader(IBeanProcessor<E> beanProcessor,
IReader reader)
- Constructs a BeanReader with a BeanProcessor and a reader.
- Parameters:
beanProcessor
- the BeanProcessor. Must be not null
.reader
- the reader. If this reader products empty row, the Beanreader
could return empty bean(use IgnoreNullReader to avoid this
case). Must be not null
.
close
public void close()
-
- Specified by:
close
in interface Closeable
hasNext
public boolean hasNext()
-
- Specified by:
hasNext
in interface Iterator<E>
next
public E next()
throws ParseException
-
- Specified by:
next
in interface Iterator<E>
- Throws:
ParseException
remove
public void remove()
- Specified by:
remove
in interface Iterator<E>
- Throws:
UnsupportedOperationException
Copyright © 2014. All rights reserved.