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

org.sfm.poi.impl.PoiBooleanGetter 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.BooleanGetter;

public class PoiBooleanGetter implements Getter, BooleanGetter {

    private final int index;

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

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

    @Override
    public boolean getBoolean(Row target) throws Exception {
        final Cell cell = target.getCell(index);
        if (cell != null) {
            return cell.getBooleanCellValue();
        } else {
            return false;
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy