|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mockrunner.jdbc.FileResultSetFactory
Can be used to create a ResultSet
based on
a table specified in a CSV file. You can specify the delimiter
of the columns (default is ";"). Furthermore you can specify if the first line
contains the column names (default is false
) and if
the column entries should be trimmed (default is true
).
The file can be specified directly or by its name. The class
tries to find the file in the absolut or relative path and
(if not found) by calling getResource
. Note that the
file must exist in the local file system and cannot be loaded from
inside a jar archive.
Constructor Summary | |
FileResultSetFactory(java.io.File file)
|
|
FileResultSetFactory(java.lang.String fileName)
|
Method Summary | |
MockResultSet |
create(java.lang.String id)
|
java.io.File |
getFile()
Get the File being used to read in the
ResultSet . |
void |
setDelimiter(java.lang.String delimiter)
Set the delimiter. |
void |
setFirstLineContainsColumnNames(boolean firstLineContainsColumnNames)
Set if the first line contains the column names. |
void |
setTrim(boolean trim)
Set if the column entries should be trimmed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FileResultSetFactory(java.lang.String fileName)
public FileResultSetFactory(java.io.File file)
Method Detail |
public java.io.File getFile()
File
being used to read in the
ResultSet
. Returns null
if
the file does not exist.
public void setDelimiter(java.lang.String delimiter)
delimiter
- the delimiterpublic void setFirstLineContainsColumnNames(boolean firstLineContainsColumnNames)
false
.
public void setTrim(boolean trim)
true
.
public MockResultSet create(java.lang.String id)
create
in interface ResultSetFactory
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |