1 /*
2 * CSVeed (https://github.com/42BV/CSVeed)
3 *
4 * Copyright 2013-2023 CSVeed.
5 *
6 * All rights reserved. This program and the accompanying materials
7 * are made available under the terms of The Apache Software License,
8 * Version 2.0 which accompanies this distribution, and is available at
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 */
11 package org.csveed.report;
12
13 import java.util.List;
14
15 /**
16 * The Class RowError.
17 */
18 public class RowError extends AbstractCsvError {
19
20 /** The report. */
21 private RowReport report;
22
23 /** The line number. */
24 private int lineNumber;
25
26 /**
27 * Instantiates a new row error.
28 *
29 * @param message
30 * the message
31 * @param report
32 * the report
33 * @param lineNumber
34 * the line number
35 */
36 public RowError(String message, RowReport report, int lineNumber) {
37 super(message);
38 this.report = report;
39 this.lineNumber = lineNumber;
40 }
41
42 /**
43 * Gets the report.
44 *
45 * @return the report
46 */
47 public RowReport getReport() {
48 return report;
49 }
50
51 @Override
52 public List<String> getPrintableLines() {
53 List<String> lines = getMessageAsList();
54 List<String> lineReport = report.getPrintableLines();
55 lines.add(lineNumber + ": " + lineReport.get(0));
56 lines.add(lineNumber + ": " + lineReport.get(1));
57 return lines;
58 }
59
60 @Override
61 public List<RowPart> getRowParts() {
62 return report.tokenize();
63 }
64
65 @Override
66 public int getLineNumber() {
67 return lineNumber;
68 }
69
70 }