|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
SimpleSVBeanLoader.java | - | 100% | 100% | 100% |
|
1 |
/*
|
|
2 |
* brownies and its relative products are published under the terms
|
|
3 |
* of the Apache Software License.
|
|
4 |
*
|
|
5 |
* Created on 2004/05/20 17:15:10
|
|
6 |
*/
|
|
7 |
package org.asyrinx.brownie.core.csv;
|
|
8 |
|
|
9 |
import java.io.IOException;
|
|
10 |
import java.io.InputStream;
|
|
11 |
import java.io.InputStreamReader;
|
|
12 |
import java.util.List;
|
|
13 |
|
|
14 |
/**
|
|
15 |
* @author akima
|
|
16 |
*/
|
|
17 |
public class SimpleSVBeanLoader implements SVParserListener, SVBeanLoader { |
|
18 |
|
|
19 |
/**
|
|
20 |
*
|
|
21 |
*/
|
|
22 | 1 |
public SimpleSVBeanLoader(SVParser parser, SVBeanMapper mapper) {
|
23 | 1 |
super();
|
24 | 1 |
this.parser = parser;
|
25 | 1 |
this.mapper = mapper;
|
26 | 1 |
this.parser.addListener(this); |
27 |
} |
|
28 |
|
|
29 |
private final SVParser parser;
|
|
30 |
|
|
31 |
private final SVBeanMapper mapper;
|
|
32 |
|
|
33 | 1 |
public void load(InputStream source) throws IOException { |
34 | 1 |
final InputStreamReader reader = new InputStreamReader(source);
|
35 | 1 |
parser.parse(reader); |
36 |
} |
|
37 |
|
|
38 |
/*
|
|
39 |
* (non-Javadoc)
|
|
40 |
*
|
|
41 |
* @see org.asyrinx.brownie.core.text.SVParserListener#onLine(java.util.List)
|
|
42 |
*/
|
|
43 | 2 |
public final void onLine(List lines) { |
44 | 2 |
loadBean(lines); |
45 |
} |
|
46 |
|
|
47 | 2 |
protected Object loadBean(List lines) {
|
48 | 2 |
return mapper.loadBean(lines);
|
49 |
} |
|
50 |
|
|
51 |
} |
|