Package net.sf.basedb.util.parser
Class FlatFileParser.ExcelData
- java.lang.Object
-
- net.sf.basedb.util.parser.FlatFileParser.Data
-
- net.sf.basedb.util.parser.FlatFileParser.ExcelData
-
- Enclosing class:
- FlatFileParser
static class FlatFileParser.ExcelData extends FlatFileParser.Data
Subclass that is used to return data when the source file is an Excel file. It will forward all get() methods to retrieve the data directly from the Cell item in Excel.
-
-
Field Summary
Fields Modifier and Type Field Description private int
colOffset
private int
rowOffset
private XlsxToCsvUtil.SheetInfo
sheet
-
Constructor Summary
Constructors Constructor Description ExcelData(XlsxToCsvUtil.SheetInfo sheet, int lineOffset, int lineNo, int dataLineNo, String line, String[] columns, boolean emptyIsNull, boolean nullIsNull, boolean trimWhiteSpace)
Create a new data object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Date
getDate(int index, Formatter<Date> parser, boolean nullIfException)
Get the value as a date.Double
getDouble(int index, NumberFormat parser, boolean nullIfException)
Get the value as a double.Float
getFloat(int index, NumberFormat parser, boolean nullIfException)
Get the value as a float.Integer
getInt(int index, NumberFormat parser, boolean nullIfException)
Get the value as an integer.Long
getLong(int index, NumberFormat parser, boolean nullIfException)
Get the value as a long.String
getString(int index)
Get the value in the specified column.
-
-
-
Field Detail
-
sheet
private final XlsxToCsvUtil.SheetInfo sheet
-
rowOffset
private final int rowOffset
-
colOffset
private final int colOffset
-
-
Constructor Detail
-
ExcelData
ExcelData(XlsxToCsvUtil.SheetInfo sheet, int lineOffset, int lineNo, int dataLineNo, String line, String[] columns, boolean emptyIsNull, boolean nullIsNull, boolean trimWhiteSpace)
Create a new data object.
-
-
Method Detail
-
getString
public String getString(int index)
Description copied from class:FlatFileParser.Data
Get the value in the specified column.- Overrides:
getString
in classFlatFileParser.Data
- Parameters:
index
- The index for the column, starting at 0- Returns:
- The value in the column
-
getInt
public Integer getInt(int index, NumberFormat parser, boolean nullIfException)
Description copied from class:FlatFileParser.Data
Get the value as an integer. The default implementation parses the string value with the given parser. If the source file is an Excel file, the numeric value may be retrieved directly.- Overrides:
getInt
in classFlatFileParser.Data
-
getLong
public Long getLong(int index, NumberFormat parser, boolean nullIfException)
Description copied from class:FlatFileParser.Data
Get the value as a long. The default implementation parses the string value with the given parser. If the source file is an Excel file, the numeric value may be retrieved directly.- Overrides:
getLong
in classFlatFileParser.Data
-
getFloat
public Float getFloat(int index, NumberFormat parser, boolean nullIfException)
Description copied from class:FlatFileParser.Data
Get the value as a float. The default implementation parses the string value with the given parser. If the source file is an Excel file, the numeric value may be retrieved directly.- Overrides:
getFloat
in classFlatFileParser.Data
-
getDouble
public Double getDouble(int index, NumberFormat parser, boolean nullIfException)
Description copied from class:FlatFileParser.Data
Get the value as a double. The default implementation parses the string value with the given parser. If the source file is an Excel file, the numeric value may be retrieved directly.- Overrides:
getDouble
in classFlatFileParser.Data
-
getDate
public Date getDate(int index, Formatter<Date> parser, boolean nullIfException)
Description copied from class:FlatFileParser.Data
Get the value as a date. The default implementation parses the string value with the given parser. If the source file is an Excel file, the date value may be retrieved directly.- Overrides:
getDate
in classFlatFileParser.Data
-
-