01: /*
02: * Copyright 2004-2006 Fouad HAMDI.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.csvbeans.parsers;
17:
18: import org.csvbeans.CSVBeansException;
19:
20: /**
21: * Parser listener which is notified about interesting events during a CSV file
22: * parsing. Implement this interface if it is needed to receive such
23: * notifications.
24: *
25: * @author Fouad Hamdi
26: * @since 0.5
27: */
28: public interface CSVParserListener {
29:
30: void onStart() throws CSVBeansException;
31:
32: /**
33: * Is called when an object has been built from a CSV line.
34: *
35: * @param bean
36: * the built object.
37: * @param line
38: * the parsed line
39: * @param currentLine
40: * the line number in the parsed file.
41: *
42: * @exception ParsingException
43: * when there is a problem with the parsed bean.
44: */
45: void onBean(Object bean, String line, int currentLine)
46: throws CSVBeansException;
47:
48: /**
49: * Is called when an error has occured during the parsing.
50: *
51: * @param e
52: * The occured error that can be used to retrieve the faulting
53: * line.
54: */
55: void onError(CSVLineException e);
56:
57: /**
58: * Is called at the end of the CSV file parsing.
59: */
60: void onEnd() throws CSVBeansException;
61: }
|