All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sfm.poi.impl.PoiByteGetter Maven / Gradle / Ivy

package org.sfm.poi.impl;


import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.sfm.reflect.Getter;
import org.sfm.reflect.primitive.ByteGetter;

public class PoiByteGetter implements Getter, ByteGetter {

    private final int index;

    public PoiByteGetter(int index) {
        this.index = index;
    }

    @Override
    public Byte get(Row target) throws Exception {
        final Cell cell = target.getCell(index);
        if (cell != null) {
            return (byte)cell.getNumericCellValue();
        } else {
            return null;
        }
    }

    @Override
    public byte getByte(Row target) throws Exception {
        final Cell cell = target.getCell(index);
        if (cell != null) {
            return (byte)cell.getNumericCellValue();
        } else {
            return 0;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy