Sha256: 5719b528a788fa4d91ba0cc1733c4191b5ca34d27266d0986b8aae8642b77dad

Contents?: true

Size: 1.74 KB

Versions: 6

Compression:

Stored size: 1.74 KB

Contents

package org.embulk.parser.poi_excel.visitor.embulk;

import org.apache.poi.ss.usermodel.Sheet;
import org.embulk.parser.poi_excel.visitor.PoiExcelVisitorValue;
import org.embulk.spi.Column;

public class LongCellVisitor extends CellVisitor {

	public LongCellVisitor(PoiExcelVisitorValue visitorValue) {
		super(visitorValue);
	}

	@Override
	public void visitCellValueNumeric(Column column, Object source, double value) {
		pageBuilder.setLong(column, (long) value);
	}

	@Override
	public void visitCellValueString(Column column, Object source, String value) {
		long l;
		try {
			l = Long.parseLong(value);
		} catch (NumberFormatException e) {
			doConvertError(column, value, e);
			return;
		}
		pageBuilder.setLong(column, l);
	}

	@Override
	public void visitCellValueBoolean(Column column, Object source, boolean value) {
		pageBuilder.setLong(column, value ? 1 : 0);
	}

	@Override
	public void visitCellValueError(Column column, Object source, int code) {
		pageBuilder.setLong(column, code);
	}

	@Override
	public void visitValueLong(Column column, Object source, long value) {
		pageBuilder.setLong(column, value);
	}

	@Override
	public void visitSheetName(Column column) {
		Sheet sheet = visitorValue.getSheet();
		int index = sheet.getWorkbook().getSheetIndex(sheet);
		pageBuilder.setLong(column, index);
	}

	@Override
	public void visitRowNumber(Column column, int index1) {
		pageBuilder.setLong(column, index1);
	}

	@Override
	public void visitColumnNumber(Column column, int index1) {
		pageBuilder.setLong(column, index1);
	}

	@Override
	protected void doConvertErrorConstant(Column column, String value) throws Exception {
		pageBuilder.setLong(column, Long.parseLong(value));
	}
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
embulk-parser-poi_excel-0.1.7 src/main/java/org/embulk/parser/poi_excel/visitor/embulk/LongCellVisitor.java
embulk-parser-poi_excel-0.1.6 src/main/java/org/embulk/parser/poi_excel/visitor/embulk/LongCellVisitor.java
embulk-parser-poi_excel-0.1.5 src/main/java/org/embulk/parser/poi_excel/visitor/embulk/LongCellVisitor.java
embulk-parser-poi_excel-0.1.4 src/main/java/org/embulk/parser/poi_excel/visitor/embulk/LongCellVisitor.java
embulk-parser-poi_excel-0.1.3 src/main/java/org/embulk/parser/poi_excel/visitor/embulk/LongCellVisitor.java
embulk-parser-poi_excel-0.1.2 src/main/java/org/embulk/parser/poi_excel/visitor/embulk/LongCellVisitor.java